mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-02 16:22:40 -06:00
SqlCtrl: ValueMap SqlCtrls::Get, ArrayCtrl: map based Set/Add, fixed some warnings and obsolete pragmas removed
git-svn-id: svn://ultimatepp.org/upp/trunk@6316 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5b209ad363
commit
376c8fcd08
26 changed files with 84 additions and 23 deletions
|
|
@ -109,8 +109,8 @@ public:
|
|||
|
||||
AMap() {}
|
||||
AMap(const AMap& s, int) : key(s.key, 0), value(s.value, 0) {}
|
||||
AMap(pick_ Index<K, HashFn>& ndx, pick_ V& val) : value(val), key(ndx) {}
|
||||
AMap(pick_ Vector<K>& ndx, pick_ V& val) : value(val), key(ndx) {}
|
||||
AMap(pick_ Index<K, HashFn>& ndx, pick_ V& val) : key(ndx), value(val) {}
|
||||
AMap(pick_ Vector<K>& ndx, pick_ V& val) : key(ndx), value(val) {}
|
||||
|
||||
typedef Vector<K> KeyContainer;
|
||||
typedef K KeyType;
|
||||
|
|
|
|||
|
|
@ -1892,6 +1892,34 @@ void ArrayCtrl::Add(const Vector<Value>& v)
|
|||
Set(array.GetCount(), v);
|
||||
}
|
||||
|
||||
void ArrayCtrl::Set(int ii, const VectorMap<String, Value>& m)
|
||||
{
|
||||
for(int i = 0; i < m.GetCount(); i++) {
|
||||
int j = GetPos(m.GetKey(i));
|
||||
if(j >= 0)
|
||||
Set(ii, j, m[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void ArrayCtrl::Set(int ii, const ValueMap& m)
|
||||
{
|
||||
for(int i = 0; i < m.GetCount(); i++) {
|
||||
int j = GetPos((String)m.GetKey(i));
|
||||
if(j >= 0)
|
||||
Set(ii, j, m.GetValue(i));
|
||||
}
|
||||
}
|
||||
|
||||
void ArrayCtrl::Add(const VectorMap<String, Value>& m)
|
||||
{
|
||||
Set(array.GetCount(), m);
|
||||
}
|
||||
|
||||
void ArrayCtrl::Add(const ValueMap& m)
|
||||
{
|
||||
Set(array.GetCount(), m);
|
||||
}
|
||||
|
||||
struct ArrayCtrlSeparatorDisplay : Display {
|
||||
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const {
|
||||
int y = r.top + r.GetHeight() / 2;
|
||||
|
|
|
|||
|
|
@ -437,6 +437,8 @@ public:
|
|||
Vector<Value> GetLine(int i) const { return ReadRow(i); }
|
||||
|
||||
void Set(int i, const Vector<Value>& v);
|
||||
void Set(int i, const VectorMap<String, Value>& m);
|
||||
void Set(int i, const ValueMap& m);
|
||||
|
||||
void Add();
|
||||
void Add(const Vector<Value>& v);
|
||||
|
|
@ -447,6 +449,10 @@ public:
|
|||
#undef E__Add
|
||||
//$+
|
||||
|
||||
void Add(const Nuller& null) { Add((Value)Null); }
|
||||
void Add(const VectorMap<String, Value>& m);
|
||||
void Add(const ValueMap& m);
|
||||
|
||||
void AddSeparator();
|
||||
|
||||
void Insert(int i);
|
||||
|
|
|
|||
|
|
@ -1969,6 +1969,36 @@ the new row of the matrix.&]
|
|||
[s7; [%-*C@3 v]-|new matrix row&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Set`(int`,const VectorMap`<String`,Value`>`&`):%- [@(0.0.255) void]_[* S
|
||||
et]([@(0.0.255) int]_[*@3 i], [@(0.0.255) const]_[_^VectorMap^ VectorMap]<[_^String^ String
|
||||
], [_^Value^ Value]>`&_[*@3 m])&]
|
||||
[s2; Sets the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Set`(int`,const ValueMap`&`):%- [@(0.0.255) void]_[* Set]([@(0.0.255) int
|
||||
]_[*@3 i], [@(0.0.255) const]_[_^ValueMap^ ValueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s2; Sets the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const VectorMap`<String`,Value`>`&`):%- [@(0.0.255) void]_[* Add](
|
||||
[@(0.0.255) const]_[_^VectorMap^ VectorMap]<[_^String^ String], [_^Value^ Value]>`&_[*@3 m])
|
||||
&]
|
||||
[s2; Adds the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const ValueMap`&`):%- [@(0.0.255) void]_[* Add]([@(0.0.255) const]_[_^ValueMap^ V
|
||||
alueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s2; Adds the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const Value`&`[`,const Value`&`]`.`.`.`):%- [@(0.0.255) void]_[* A
|
||||
dd]([@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_`[, [@(0.0.255) const]_[_^Value^ Val
|
||||
ue][@(0.0.255) `&]_`]...)&]
|
||||
|
|
@ -1979,6 +2009,12 @@ Its arguments are used to initialize the source indices in the
|
|||
newly added row.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const Nuller`&`):%- [@(0.0.255) void]_[* Add]([@(0.0.255) const]_[_^Nuller^ N
|
||||
uller][@(0.0.255) `&]_[*@3 null])&]
|
||||
[s2; This is helper method required for correct overloading resolution
|
||||
of Add(Null).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Insert`(int`):%- [@(0.0.255) void]_[* Insert]([@(0.0.255) int]_[*@3 i])&]
|
||||
[s2; Inserts a new row into the source array. All indices are initialized
|
||||
to [* Null] values. The [* InsertValue] property doesn`'t apply;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCoords.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCoords.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCoords.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "method.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCoords.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCtrl.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCtrl.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomCtrl.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomDraw.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// hrr: high resolution raster.
|
||||
|
||||
#include "GeomDraw.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "hrr.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomDraw.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomDraw.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "GeomDraw.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Geom.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Geom.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Geom.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "Oracle7.h"
|
||||
#include "OciCommon.h"
|
||||
#pragma hdrstop
|
||||
|
||||
/*
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "Oracle8.h"
|
||||
#include "OciCommon.h"
|
||||
#pragma hdrstop
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "RichBook.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include <DocTypes/DocTypes.h>
|
||||
#include <PdfDraw/PdfDraw.h>
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ SqlBool FindSchJoin(const String& tables)
|
|||
}
|
||||
}
|
||||
}
|
||||
NEVER_("Schema join not found");
|
||||
NEVER_("Schema join not found " + tables);
|
||||
return SqlBool::False();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include <OleDB/OleDB.h>
|
||||
#include <SqlCtrl/SqlCtrl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#define HAVE_ORACLE
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,14 @@ void SqlCtrls::Enable(bool b)
|
|||
item[i].ctrl->Enable(b);
|
||||
}
|
||||
|
||||
ValueMap SqlCtrls::Get() const
|
||||
{
|
||||
ValueMap m;
|
||||
for(int i = 0; i < item.GetCount(); i++)
|
||||
m.Add(item[i].id, item[i].ctrl->GetData());
|
||||
return m;
|
||||
}
|
||||
|
||||
void SqlCtrls::SetNull()
|
||||
{
|
||||
for(int i = 0; i < item.GetCount(); i++)
|
||||
|
|
|
|||
|
|
@ -183,7 +183,9 @@ public:
|
|||
const Ctrl& operator[](int i) const { return *item[i].ctrl; }
|
||||
SqlId operator()(int i) const { return item[i].id; }
|
||||
|
||||
void Reset() { item.Clear(); }
|
||||
ValueMap Get() const;
|
||||
|
||||
void Reset() { item.Clear(); }
|
||||
};
|
||||
|
||||
class SqlDetail : public StaticRect {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue