diff --git a/uppsrc/Core/Map.h b/uppsrc/Core/Map.h index c81d0a5de..3d2ec4a1f 100644 --- a/uppsrc/Core/Map.h +++ b/uppsrc/Core/Map.h @@ -109,8 +109,8 @@ public: AMap() {} AMap(const AMap& s, int) : key(s.key, 0), value(s.value, 0) {} - AMap(pick_ Index& ndx, pick_ V& val) : value(val), key(ndx) {} - AMap(pick_ Vector& ndx, pick_ V& val) : value(val), key(ndx) {} + AMap(pick_ Index& ndx, pick_ V& val) : key(ndx), value(val) {} + AMap(pick_ Vector& ndx, pick_ V& val) : key(ndx), value(val) {} typedef Vector KeyContainer; typedef K KeyType; diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index 41d61ffc6..b804f0ab3 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -1892,6 +1892,34 @@ void ArrayCtrl::Add(const Vector& v) Set(array.GetCount(), v); } +void ArrayCtrl::Set(int ii, const VectorMap& 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& 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; diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index 4e1b55874..1de30e213 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -437,6 +437,8 @@ public: Vector GetLine(int i) const { return ReadRow(i); } void Set(int i, const Vector& v); + void Set(int i, const VectorMap& m); + void Set(int i, const ValueMap& m); void Add(); void Add(const Vector& v); @@ -447,6 +449,10 @@ public: #undef E__Add //$+ + void Add(const Nuller& null) { Add((Value)Null); } + void Add(const VectorMap& m); + void Add(const ValueMap& m); + void AddSeparator(); void Insert(int i); diff --git a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp index 4c32227f0..86081ae92 100644 --- a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp @@ -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``&`):%- [@(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``&`):%- [@(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; diff --git a/uppsrc/Geom/Coords/coords.cpp b/uppsrc/Geom/Coords/coords.cpp index f0e8b40d7..8b9184e4a 100644 --- a/uppsrc/Geom/Coords/coords.cpp +++ b/uppsrc/Geom/Coords/coords.cpp @@ -1,5 +1,4 @@ #include "GeomCoords.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Coords/ellipsoid.cpp b/uppsrc/Geom/Coords/ellipsoid.cpp index 3db51fd02..908d1c4f1 100644 --- a/uppsrc/Geom/Coords/ellipsoid.cpp +++ b/uppsrc/Geom/Coords/ellipsoid.cpp @@ -1,5 +1,4 @@ #include "GeomCoords.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Coords/method.cpp b/uppsrc/Geom/Coords/method.cpp index 5fcd55300..ade0dd93b 100644 --- a/uppsrc/Geom/Coords/method.cpp +++ b/uppsrc/Geom/Coords/method.cpp @@ -1,5 +1,4 @@ #include "GeomCoords.h" -#pragma hdrstop #include "method.h" diff --git a/uppsrc/Geom/Coords/util.cpp b/uppsrc/Geom/Coords/util.cpp index 899a2e4d8..5db852572 100644 --- a/uppsrc/Geom/Coords/util.cpp +++ b/uppsrc/Geom/Coords/util.cpp @@ -1,5 +1,4 @@ #include "GeomCoords.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Ctrl/CoordCtrl.cpp b/uppsrc/Geom/Ctrl/CoordCtrl.cpp index 1783b4702..d1b7c7cc0 100644 --- a/uppsrc/Geom/Ctrl/CoordCtrl.cpp +++ b/uppsrc/Geom/Ctrl/CoordCtrl.cpp @@ -1,5 +1,4 @@ #include "GeomCtrl.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Ctrl/PlotterCtrl.cpp b/uppsrc/Geom/Ctrl/PlotterCtrl.cpp index d9e7c6085..66f9fa77e 100644 --- a/uppsrc/Geom/Ctrl/PlotterCtrl.cpp +++ b/uppsrc/Geom/Ctrl/PlotterCtrl.cpp @@ -1,5 +1,4 @@ #include "GeomCtrl.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Ctrl/pathCtrl.cpp b/uppsrc/Geom/Ctrl/pathCtrl.cpp index e57804b4a..833fb7007 100644 --- a/uppsrc/Geom/Ctrl/pathCtrl.cpp +++ b/uppsrc/Geom/Ctrl/pathCtrl.cpp @@ -1,5 +1,4 @@ #include "GeomCtrl.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Draw/coordutil.cpp b/uppsrc/Geom/Draw/coordutil.cpp index 550885b04..5796c0fcb 100644 --- a/uppsrc/Geom/Draw/coordutil.cpp +++ b/uppsrc/Geom/Draw/coordutil.cpp @@ -1,5 +1,4 @@ #include "GeomDraw.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Draw/hrr.cpp b/uppsrc/Geom/Draw/hrr.cpp index 357708f79..09eb29812 100644 --- a/uppsrc/Geom/Draw/hrr.cpp +++ b/uppsrc/Geom/Draw/hrr.cpp @@ -2,7 +2,6 @@ // hrr: high resolution raster. #include "GeomDraw.h" -#pragma hdrstop #include "hrr.h" diff --git a/uppsrc/Geom/Draw/imgtran.cpp b/uppsrc/Geom/Draw/imgtran.cpp index 3dc22bc5d..0d3285189 100644 --- a/uppsrc/Geom/Draw/imgtran.cpp +++ b/uppsrc/Geom/Draw/imgtran.cpp @@ -1,5 +1,4 @@ #include "GeomDraw.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Draw/pathDraw.cpp b/uppsrc/Geom/Draw/pathDraw.cpp index 0653e3ef2..454806163 100644 --- a/uppsrc/Geom/Draw/pathDraw.cpp +++ b/uppsrc/Geom/Draw/pathDraw.cpp @@ -1,5 +1,4 @@ #include "GeomDraw.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/Draw/plotter.cpp b/uppsrc/Geom/Draw/plotter.cpp index b442690e0..ae35e3b60 100644 --- a/uppsrc/Geom/Draw/plotter.cpp +++ b/uppsrc/Geom/Draw/plotter.cpp @@ -1,5 +1,4 @@ #include "GeomDraw.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/delaunay.cpp b/uppsrc/Geom/delaunay.cpp index bcae5c85b..d0df9b76b 100644 --- a/uppsrc/Geom/delaunay.cpp +++ b/uppsrc/Geom/delaunay.cpp @@ -1,5 +1,4 @@ #include "Geom.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/fp3.cpp b/uppsrc/Geom/fp3.cpp index ed82fdb32..1e0f70175 100644 --- a/uppsrc/Geom/fp3.cpp +++ b/uppsrc/Geom/fp3.cpp @@ -1,5 +1,4 @@ #include "Geom.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Geom/polyalg.cpp b/uppsrc/Geom/polyalg.cpp index b71ccf53a..8cf2187c3 100644 --- a/uppsrc/Geom/polyalg.cpp +++ b/uppsrc/Geom/polyalg.cpp @@ -1,5 +1,4 @@ #include "Geom.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/Oracle/Oci7.cpp b/uppsrc/Oracle/Oci7.cpp index acd634d58..9fd89dc47 100644 --- a/uppsrc/Oracle/Oci7.cpp +++ b/uppsrc/Oracle/Oci7.cpp @@ -1,6 +1,5 @@ #include "Oracle7.h" #include "OciCommon.h" -#pragma hdrstop /* extern "C" { diff --git a/uppsrc/Oracle/Oci8.cpp b/uppsrc/Oracle/Oci8.cpp index 43e06ba69..13d7a1542 100644 --- a/uppsrc/Oracle/Oci8.cpp +++ b/uppsrc/Oracle/Oci8.cpp @@ -1,6 +1,5 @@ #include "Oracle8.h" #include "OciCommon.h" -#pragma hdrstop NAMESPACE_UPP diff --git a/uppsrc/RichBook/RichBook.cpp b/uppsrc/RichBook/RichBook.cpp index 797fa2511..387af40a1 100644 --- a/uppsrc/RichBook/RichBook.cpp +++ b/uppsrc/RichBook/RichBook.cpp @@ -1,5 +1,4 @@ #include "RichBook.h" -#pragma hdrstop #include #include diff --git a/uppsrc/Sql/IntroSch.cpp b/uppsrc/Sql/IntroSch.cpp index 8a93ece16..66e76f83e 100644 --- a/uppsrc/Sql/IntroSch.cpp +++ b/uppsrc/Sql/IntroSch.cpp @@ -149,7 +149,7 @@ SqlBool FindSchJoin(const String& tables) } } } - NEVER_("Schema join not found"); + NEVER_("Schema join not found " + tables); return SqlBool::False(); } diff --git a/uppsrc/SqlCommander/SqlCommander.cpp b/uppsrc/SqlCommander/SqlCommander.cpp index dadd4e111..00363cd51 100644 --- a/uppsrc/SqlCommander/SqlCommander.cpp +++ b/uppsrc/SqlCommander/SqlCommander.cpp @@ -1,6 +1,5 @@ #include #include -#pragma hdrstop #define HAVE_ORACLE diff --git a/uppsrc/SqlCtrl/SqlCtrl.cpp b/uppsrc/SqlCtrl/SqlCtrl.cpp index 1f635d6fd..6296f540f 100644 --- a/uppsrc/SqlCtrl/SqlCtrl.cpp +++ b/uppsrc/SqlCtrl/SqlCtrl.cpp @@ -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++) diff --git a/uppsrc/SqlCtrl/SqlCtrl.h b/uppsrc/SqlCtrl/SqlCtrl.h index 597b21c75..04a5d0d4d 100644 --- a/uppsrc/SqlCtrl/SqlCtrl.h +++ b/uppsrc/SqlCtrl/SqlCtrl.h @@ -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 {