Author: sayer
Date: 2009-05-11 16:04:16 +0200 (Mon, 11 May 2009)
New Revision: 1378

Modified:
   trunk/core/AmArg.cpp
   trunk/core/AmArg.h
Log:
push and pop functions; making assert... functions visible


Modified: trunk/core/AmArg.cpp
===================================================================
--- trunk/core/AmArg.cpp        2009-05-10 20:31:45 UTC (rev 1377)
+++ trunk/core/AmArg.cpp        2009-05-11 14:04:16 UTC (rev 1378)
@@ -170,6 +170,17 @@
   v_array->push_back(a);
 }
 
+void AmArg::push(const string &key, const AmArg &val) {
+  assertStruct();
+  (*v_struct)[key] = val;
+}
+
+void AmArg::pop(AmArg &a) {
+  assertArray();
+  a = v_array->front();
+  v_array->erase(v_array->begin());
+}
+
 void AmArg::concat(const AmArg& a) {
   assertArray();
   if (a.getType() == Array) { 

Modified: trunk/core/AmArg.h
===================================================================
--- trunk/core/AmArg.h  2009-05-10 20:31:45 UTC (rev 1377)
+++ trunk/core/AmArg.h  2009-05-11 14:04:16 UTC (rev 1378)
@@ -122,12 +122,7 @@
   void invalidate();
 
  public:
-  void assertArray();
-  void assertArray() const;
 
-  void assertStruct();
-  void assertStruct() const;
-
  AmArg() 
    : type(Undef) 
   { }
@@ -150,6 +145,12 @@
     v_cstr = strdup(v);
   }
   
+ AmArg(const string &v)
+   : type(CStr)
+  {
+    v_cstr = strdup(v.c_str());
+  }
+  
  AmArg(const ArgBlob v)
    : type(Blob)
   {
@@ -165,6 +166,12 @@
   
   ~AmArg() { invalidate(); }
 
+  void assertArray();
+  void assertArray() const;
+
+  void assertStruct();
+  void assertStruct() const;
+
   short getType() const { return type; }
 
   AmArg& operator=(const AmArg& rhs);
@@ -227,6 +234,8 @@
   void assertArray(size_t s);
 
   void push(const AmArg& a);
+  void push(const string &key, const AmArg &val);
+  void pop(AmArg &a);
 
   void concat(const AmArg& a);
   

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to