Index: ext/libicpf/src/config_property.cpp =================================================================== diff -u -N -r771dac1fbb7608aa92942c6cab7c5c8b0cccb791 -rfd1f0cf4d6ad9ff63fd9252a3f2f31c992431842 --- ext/libicpf/src/config_property.cpp (.../config_property.cpp) (revision 771dac1fbb7608aa92942c6cab7c5c8b0cccb791) +++ ext/libicpf/src/config_property.cpp (.../config_property.cpp) (revision fd1f0cf4d6ad9ff63fd9252a3f2f31c992431842) @@ -15,7 +15,7 @@ /** Constructs a property object. */ property::property() : - m_uiPropType(prop_type::type_unknown | prop_flags::flag_none), + m_uiPropType(type_unknown | flag_none), m_pszName(NULL) { memset(&m_val, 0, sizeof(_VALUE)); @@ -63,21 +63,21 @@ clear_value(); // copy the value(s) - if (rSrc.m_uiPropType & prop_flags::flag_array) + if (rSrc.m_uiPropType & flag_array) { // source property is an array - switch(rSrc.m_uiPropType & prop_mask::mask_type) + switch(rSrc.m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: m_val.hArray=new std::vector(*(std::vector*)rSrc.m_val.hArray); break; - case prop_type::type_signed_num: + case type_signed_num: m_val.hArray=new std::vector(*(std::vector*)rSrc.m_val.hArray); break; - case prop_type::type_unsigned_num: + case type_unsigned_num: m_val.hArray=new std::vector(*(std::vector*)rSrc.m_val.hArray); break; - case prop_type::type_bool: + case type_bool: m_val.hArray=new std::vector(*(std::vector*)rSrc.m_val.hArray); break; default: @@ -87,28 +87,28 @@ else { // source property is normal value - switch(rSrc.m_uiPropType & prop_mask::mask_type) + switch(rSrc.m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: { m_val.pszVal=copy_string(rSrc.m_val.pszVal); break; } - case prop_type::type_signed_num: + case type_signed_num: { m_val.llVal=rSrc.m_val.llVal; m_range.ll.llHi=rSrc.m_range.ll.llHi; m_range.ll.llLo=rSrc.m_range.ll.llLo; break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { m_val.ullVal=rSrc.m_val.ullVal; m_range.ull.ullHi=rSrc.m_range.ull.ullHi; m_range.ull.ullLo=rSrc.m_range.ull.ullLo; break; } - case prop_type::type_bool: + case type_bool: { m_val.bVal=rSrc.m_val.bVal; break; @@ -137,7 +137,7 @@ clear_value(); // reset other members - m_uiPropType=prop_type::type_unknown | prop_flags::flag_none; + m_uiPropType=type_unknown | flag_none; } /** Initializes the property for storaging of the specific property @@ -158,24 +158,24 @@ m_uiPropType=uiType; // and alloc memory for the array property types - if (uiType & prop_flags::flag_array) + if (uiType & flag_array) { - switch(uiType & prop_mask::mask_type) + switch(uiType & mask_type) { - case prop_type::type_string: + case type_string: m_val.hArray=(ptr_t)new std::vector; break; - case prop_type::type_signed_num: + case type_signed_num: m_val.hArray=(ptr_t)new std::vector; m_range.ll.llLo=_I64_MIN; m_range.ll.llHi=_I64_MAX; break; - case prop_type::type_unsigned_num: + case type_unsigned_num: m_val.hArray=(ptr_t)new std::vector; m_range.ull.ullLo=0; m_range.ull.ullHi=_UI64_MAX; break; - case prop_type::type_bool: + case type_bool: m_val.hArray=(ptr_t)new std::vector; break; default: @@ -184,16 +184,16 @@ } else { - switch(uiType & prop_mask::mask_type) + switch(uiType & mask_type) { - case prop_type::type_string: - case prop_type::type_bool: + case type_string: + case type_bool: break; - case prop_type::type_signed_num: + case type_signed_num: m_range.ll.llLo=_I64_MIN; m_range.ll.llHi=_I64_MAX; break; - case prop_type::type_unsigned_num: + case type_unsigned_num: m_range.ull.ullLo=0; m_range.ull.ullHi=_UI64_MAX; break; @@ -215,26 +215,26 @@ */ void property::set_value(const tchar_t* pszValue, actions a, size_t tIndex) { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: { switch(a) { - case actions::action_replace: + case action_replace: { m_paStrings->clear(); m_paStrings->push_back(tstring(pszValue)); break; } - case actions::action_add: + case action_add: { m_paStrings->push_back(tstring(pszValue)); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paStrings->size()); @@ -247,22 +247,22 @@ } break; } - case prop_type::type_bool: + case type_bool: { switch(a) { - case actions::action_replace: + case action_replace: { m_paBools->clear(); m_paBools->push_back(bool_from_string(pszValue)); break; } - case actions::action_add: + case action_add: { m_paBools->push_back(bool_from_string(pszValue)); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paBools->size()); @@ -275,22 +275,22 @@ } break; } - case prop_type::type_signed_num: + case type_signed_num: { switch(a) { - case actions::action_replace: + case action_replace: { m_paSigneds->clear(); m_paSigneds->push_back(signed_from_string(pszValue)); break; } - case actions::action_add: + case action_add: { m_paSigneds->push_back(signed_from_string(pszValue)); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paSigneds->size()); @@ -303,22 +303,22 @@ } break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { switch(a) { - case actions::action_replace: + case action_replace: { m_paUnsigneds->clear(); m_paUnsigneds->push_back(unsigned_from_string(pszValue)); break; } - case actions::action_add: + case action_add: { m_paUnsigneds->push_back(unsigned_from_string(pszValue)); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paUnsigneds->size()); @@ -335,25 +335,25 @@ } else { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: { delete [] m_val.pszVal; m_val.pszVal=copy_string(pszValue); break; } - case prop_type::type_signed_num: + case type_signed_num: { m_val.llVal=signed_from_string(pszValue); break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { m_val.ullVal=unsigned_from_string(pszValue); break; } - case prop_type::type_bool: + case type_bool: { m_val.bVal=bool_from_string(pszValue); break; @@ -379,23 +379,23 @@ { assert(pszString); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: assert(stIndex < m_paStrings->size()); return m_paStrings->at(stIndex).c_str(); break; - case prop_type::type_signed_num: + case type_signed_num: assert(stIndex < m_paSigneds->size()); _sntprintf(pszString, stMaxSize, LLFMT, m_paSigneds->at(stIndex)); break; - case prop_type::type_unsigned_num: + case type_unsigned_num: assert(stIndex < m_paUnsigneds->size()); _sntprintf(pszString, stMaxSize, ULLFMT, m_paUnsigneds->at(stIndex)); break; - case prop_type::type_bool: + case type_bool: assert(stIndex < m_paBools->size()); _sntprintf(pszString, stMaxSize, USFMT, (ushort_t)m_paBools->at(stIndex)); break; @@ -405,18 +405,18 @@ } else { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: return m_val.pszVal; break; - case prop_type::type_signed_num: + case type_signed_num: _sntprintf(pszString, stMaxSize, LLFMT, m_val.llVal); break; - case prop_type::type_unsigned_num: + case type_unsigned_num: _sntprintf(pszString, stMaxSize, ULLFMT, m_val.ullVal); break; - case prop_type::type_bool: + case type_bool: _sntprintf(pszString, stMaxSize, USFMT, (ushort_t)m_val.bVal); break; default: @@ -436,24 +436,24 @@ */ void property::set_string(const tchar_t* pszValue, actions a, size_t tIndex) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_string); + assert((m_uiPropType & mask_type) == type_string); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { switch(a) { - case actions::action_replace: + case action_replace: { m_paStrings->clear(); m_paStrings->push_back(tstring(pszValue)); break; } - case actions::action_add: + case action_add: { m_paStrings->push_back(tstring(pszValue)); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paStrings->size()); tstring& str=m_paStrings->at(tIndex); @@ -479,9 +479,9 @@ */ const tchar_t* property::get_string(size_t stIndex) const { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_string); + assert((m_uiPropType & mask_type) == type_string); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { assert(stIndex < m_paStrings->size()); return m_paStrings->at(stIndex).c_str(); @@ -499,24 +499,24 @@ */ void property::set_signed_num(ll_t llValue, actions a, size_t tIndex) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_signed_num); + assert((m_uiPropType & mask_type) == type_signed_num); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { switch(a) { - case actions::action_replace: + case action_replace: { m_paSigneds->clear(); m_paSigneds->push_back(llValue); break; } - case actions::action_add: + case action_add: { m_paSigneds->push_back(llValue); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paSigneds->size()); ll_t& ll=m_paSigneds->at(tIndex); @@ -540,7 +540,7 @@ */ void property::set_signed_range(ll_t llMin, ll_t llMax) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_signed_num); + assert((m_uiPropType & mask_type) == type_signed_num); // set new range m_range.ll.llLo=llMin; @@ -558,9 +558,9 @@ */ ll_t property::get_signed_num(size_t stIndex) const { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_signed_num); + assert((m_uiPropType & mask_type) == type_signed_num); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { assert(stIndex < m_paSigneds->size()); return m_paSigneds->at(stIndex); @@ -578,24 +578,24 @@ */ void property::set_unsigned_num(ull_t ullValue, actions a, size_t tIndex) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_unsigned_num); + assert((m_uiPropType & mask_type) == type_unsigned_num); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { switch(a) { - case actions::action_replace: + case action_replace: { m_paUnsigneds->clear(); m_paUnsigneds->push_back(ullValue); break; } - case actions::action_add: + case action_add: { m_paUnsigneds->push_back(ullValue); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paUnsigneds->size()); ull_t& ull=m_paUnsigneds->at(tIndex); @@ -619,7 +619,7 @@ */ void property::set_unsigned_range(ull_t ullMin, ull_t ullMax) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_unsigned_num); + assert((m_uiPropType & mask_type) == type_unsigned_num); // set new range m_range.ull.ullLo=ullMin; @@ -637,9 +637,9 @@ */ ull_t property::get_unsigned_num(size_t stIndex) const { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_unsigned_num); + assert((m_uiPropType & mask_type) == type_unsigned_num); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { assert(stIndex < m_paUnsigneds->size()); return m_paUnsigneds->at(stIndex); @@ -657,24 +657,24 @@ */ void property::set_bool(bool bValue, actions a, size_t tIndex) { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_bool); + assert((m_uiPropType & mask_type) == type_bool); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { switch(a) { - case actions::action_replace: + case action_replace: { m_paBools->clear(); m_paBools->push_back(bValue); break; } - case actions::action_add: + case action_add: { m_paBools->push_back(bValue); break; } - case actions::action_setat: + case action_setat: { assert(tIndex < m_paBools->size()); std::vector::iterator it=m_paBools->begin()+tIndex; @@ -697,9 +697,9 @@ */ bool property::get_bool(size_t stIndex) const { - assert((m_uiPropType & prop_mask::mask_type) == prop_type::type_bool); + assert((m_uiPropType & mask_type) == type_bool); - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { assert(stIndex < m_paBools->size()); return m_paBools->at(stIndex); @@ -714,17 +714,17 @@ */ size_t property::get_count() const { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: return m_paStrings->size(); - case prop_type::type_signed_num: + case type_signed_num: return m_paSigneds->size(); - case prop_type::type_unsigned_num: + case type_unsigned_num: return m_paUnsigneds->size(); - case prop_type::type_bool: + case type_bool: return m_paBools->size(); default: assert(false); // unhandled property type @@ -741,29 +741,29 @@ */ void property::remove(size_t stIndex) { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: { assert(stIndex < m_paStrings->size()); m_paStrings->erase(m_paStrings->begin()+stIndex); break; } - case prop_type::type_signed_num: + case type_signed_num: { assert(stIndex < m_paSigneds->size()); m_paSigneds->erase(m_paSigneds->begin()+stIndex); break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { assert(stIndex < m_paUnsigneds->size()); m_paUnsigneds->erase(m_paUnsigneds->begin()+stIndex); break; } - case prop_type::type_bool: + case type_bool: { assert(stIndex < m_paBools->size()); m_paBools->erase(m_paBools->begin()+stIndex); @@ -781,20 +781,20 @@ */ void property::clear_array() { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: m_paStrings->clear(); break; - case prop_type::type_signed_num: + case type_signed_num: m_paSigneds->clear(); break; - case prop_type::type_unsigned_num: + case type_unsigned_num: m_paUnsigneds->clear(); break; - case prop_type::type_bool: + case type_bool: m_paBools->clear(); break; default: @@ -809,20 +809,20 @@ */ void property::clear_value() { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: delete m_paStrings; break; - case prop_type::type_signed_num: + case type_signed_num: delete m_paSigneds; break; - case prop_type::type_unsigned_num: + case type_unsigned_num: delete m_paUnsigneds; break; - case prop_type::type_bool: + case type_bool: delete m_paBools; break; default: @@ -833,19 +833,19 @@ } else { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_string: + case type_string: delete [] m_val.pszVal; m_val.pszVal=NULL; break; - case prop_type::type_signed_num: + case type_signed_num: m_val.llVal=0LL; break; - case prop_type::type_unsigned_num: + case type_unsigned_num: m_val.ullVal=0ULL; break; - case prop_type::type_bool: + case type_bool: m_val.bVal=false; break; default: @@ -859,11 +859,11 @@ */ void property::check_range() { - if (m_uiPropType & prop_flags::flag_array) + if (m_uiPropType & flag_array) { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_signed_num: + case type_signed_num: { for (std::vector::iterator it=m_paSigneds->begin();it != m_paSigneds->end();it++) { @@ -874,7 +874,7 @@ } break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { for (std::vector::iterator it=m_paUnsigneds->begin();it != m_paUnsigneds->end();it++) { @@ -889,9 +889,9 @@ } else { - switch(m_uiPropType & prop_mask::mask_type) + switch(m_uiPropType & mask_type) { - case prop_type::type_signed_num: + case type_signed_num: { // check range if (m_val.llVal < m_range.ll.llLo) @@ -900,7 +900,7 @@ m_val.llVal=m_range.ll.llHi; break; } - case prop_type::type_unsigned_num: + case type_unsigned_num: { // check range if (m_val.ullVal < m_range.ull.ullLo)