XMLAttributeList.cpp
Go to the documentation of this file.00001 //*** XMLAttributeList.cpp *** 00002 00003 #include "XMLAttributeList.h" 00004 00005 //*** Add *** 00006 00007 void XMLAttributeList::Add(StringId name, const XMLVariant& value) 00008 { 00009 Attribute& attribute=attributes_.Add(Attribute()); 00010 attribute.name=name; 00011 attribute.value=value; 00012 } 00013 00014 00015 //*** GetCount *** 00016 00017 int XMLAttributeList::GetCount() const 00018 { 00019 return attributes_.GetItemCount(); 00020 } 00021 00022 00023 //*** GetName *** 00024 00025 StringId XMLAttributeList::GetName(int index) const 00026 { 00027 return attributes_.Get(index).name; 00028 } 00029 00030 00031 //*** GetValue *** 00032 00033 const XMLVariant& XMLAttributeList::GetValue(int index) const 00034 { 00035 return attributes_.Get(index).value; 00036 } 00037 00038 00039 //*** GetValue *** 00040 00041 const XMLVariant& XMLAttributeList::GetValue(StringId name) const 00042 { 00043 int index=GetIndex(name); 00044 if (index<0) 00045 { 00046 static XMLVariant emptyValue; 00047 return emptyValue; 00048 } 00049 00050 return GetValue(index); 00051 } 00052 00053 00054 //*** GetIndex *** 00055 00056 int XMLAttributeList::GetIndex(StringId name) const 00057 { 00058 for (int i=0; i<attributes_.GetItemCount(); i++) 00059 { 00060 if (attributes_.Get(i).name==name) 00061 { 00062 return i; 00063 } 00064 } 00065 return -1; 00066 } 00067
Reproduction/republishing of any material on this site without permission is strictly prohibited.
