diff --git a/core/AmArg.cpp b/core/AmArg.cpp index f0cd12af..7c552979 100644 --- a/core/AmArg.cpp +++ b/core/AmArg.cpp @@ -180,10 +180,13 @@ void AmArg::concat(const AmArg& a) { } const size_t AmArg::size() const { - if ((Array != type) && (Struct != type)) - throw TypeMismatchException(); + if (Array == type) + return v_array->size(); + + if (Struct == type) + return v_struct->size(); - return v_array->size(); + throw TypeMismatchException(); } AmArg& AmArg::get(size_t idx) { @@ -281,6 +284,10 @@ AmArg::ValueStruct::const_iterator AmArg::end() const { return v_struct->end(); } +void AmArg::erase(const char* name) { + assertStruct(); + v_struct->erase(name); +} void AmArg::assertArrayFmt(const char* format) const { size_t fmt_len = strlen(format); diff --git a/core/AmArg.h b/core/AmArg.h index bfe2558c..520bea99 100644 --- a/core/AmArg.h +++ b/core/AmArg.h @@ -261,6 +261,9 @@ class AmArg ValueStruct::const_iterator begin() const; ValueStruct::const_iterator end() const; + /** remove struct member */ + void erase(const char* name); + /** * throws exception if arg array does not conform to spec * i - int