diff --git a/Source/ZenLib/InfoMap.h b/Source/ZenLib/InfoMap.h index 0711de28..88c36caa 100644 --- a/Source/ZenLib/InfoMap.h +++ b/Source/ZenLib/InfoMap.h @@ -21,7 +21,7 @@ namespace ZenLib /// @brief Helper for InfoMap //*************************************************************************** -class InfoMap : public std::multimap +class InfoMap : public std::multimap, protected ZSeparator { public : //Constructors/Destructor @@ -47,10 +47,6 @@ public : /// During Read() or Write() method, if there is more elements, merge them with the last element void Max_Set (size_type Level, size_type Max); -protected : - Ztring Separator[2]; - Ztring Quote; - size_type Max[2]; }; } //namespace diff --git a/Source/ZenLib/Translation.h b/Source/ZenLib/Translation.h index cedc455f..678935ce 100644 --- a/Source/ZenLib/Translation.h +++ b/Source/ZenLib/Translation.h @@ -21,7 +21,7 @@ namespace ZenLib /// @brief Helper for translation //*************************************************************************** -class Translation : public std::map +class Translation : public std::map, protected ZSeparator { public : //Constructors/Destructor @@ -49,10 +49,6 @@ public : /// During Read() or Write() method, if there is more elements, merge them with the last element void Max_Set (size_type Level, size_type Max); -protected : - Ztring Separator[2]; - Ztring Quote; - size_type Max[2]; }; } //namespace diff --git a/Source/ZenLib/Ztring.h b/Source/ZenLib/Ztring.h index ea16d9af..d67bcf4e 100644 --- a/Source/ZenLib/Ztring.h +++ b/Source/ZenLib/Ztring.h @@ -364,6 +364,19 @@ public : bool Compare (const Ztring &ToCompare, const Ztring &Comparator=__T("=="), ztring_t Options=Ztring_Nothing) const; }; +class ZSeparator +{ + public: + ZSeparator() + { + Max[0] = Max[1] = Error; + } + protected: + Ztring Separator[2]; + Ztring Quote; + size_t Max[2]; +}; + } //NameSpace #endif diff --git a/Source/ZenLib/ZtringList.cpp b/Source/ZenLib/ZtringList.cpp index a58f9fd7..5c2b10ab 100644 --- a/Source/ZenLib/ZtringList.cpp +++ b/Source/ZenLib/ZtringList.cpp @@ -49,6 +49,7 @@ ZtringList::ZtringList () ZtringList::ZtringList(const ZtringList &Source) : std::vector > () { + Max[0] = Error; Separator[0]=Source.Separator[0]; Quote=Source.Quote; @@ -76,6 +77,7 @@ ZtringList::ZtringList (const Char *Source) #ifdef _UNICODE ZtringList::ZtringList (const char* S) { + Max[0] = Error; Write(Ztring(S)); } #endif diff --git a/Source/ZenLib/ZtringListList.h b/Source/ZenLib/ZtringListList.h index f7102458..5b8bb459 100644 --- a/Source/ZenLib/ZtringListList.h +++ b/Source/ZenLib/ZtringListList.h @@ -26,7 +26,7 @@ namespace ZenLib /// @brief Vector of vectors of strings manipulation (based on std::vector>) //*************************************************************************** -class ZtringListList : public std::vector +class ZtringListList : public std::vector, protected ZSeparator { public : //Constructors/Destructor @@ -122,10 +122,6 @@ public : /// During Read() or Write() method, if there is more elements, merge them with the last element void Max_Set (size_type Level, size_type Max); -protected : - Ztring Separator[2]; - Ztring Quote; - size_type Max[2]; }; } //namespace diff --git a/Source/ZenLib/ZtringListListF.cpp b/Source/ZenLib/ZtringListListF.cpp index a89693d4..d97b42f6 100644 --- a/Source/ZenLib/ZtringListListF.cpp +++ b/Source/ZenLib/ZtringListListF.cpp @@ -147,7 +147,7 @@ bool ZtringListListF::CSV_Charger () //Separators if (Separator[0]==__T("(Default)")) Separator[0]=EOL; - Ztring SeparatorT=Separator[1]; + const Ztring SeparatorT=Separator[1]; Separator[1]=__T(";"); //Writing @@ -183,7 +183,7 @@ bool ZtringListListF::CFG_Charger () Z1.From_UTF8((char*)Buffer, 0, BytesCount); List.Write(Z1); - Ztring SeparatorT=Separator[1]; + const Ztring SeparatorT=Separator[1]; Separator[1]=__T(";"); Ztring Propriete, Valeur, Commentaire;