added: to Space:
std::wstring & FindAdd(const WTextStream & name); std::wstring & Add(const wchar_t * name, const WTextStream & value); std::wstring & Add(const std::wstring & name, const WTextStream & value); std::wstring & Add(const WTextStream & name, const WTextStream & value); git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@430 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
jsontospaceparser.o: jsontospaceparser.h space.h ../utf8/utf8.h
|
||||
space.o: space.h ../utf8/utf8.h
|
||||
spaceparser.o: spaceparser.h space.h ../utf8/utf8.h
|
||||
spacetojson.o: spacetojson.h space.h
|
||||
jsontospaceparser.o: jsontospaceparser.h space.h ../textstream/types.h
|
||||
jsontospaceparser.o: ../utf8/utf8.h
|
||||
space.o: space.h ../textstream/types.h ../utf8/utf8.h
|
||||
space.o: ../textstream/textstream.h ../space/space.h ../date/date.h
|
||||
space.o: ../convert/convert.h ../convert/inttostr.h ../membuffer/membuffer.h
|
||||
space.o: ../textstream/types.h
|
||||
spaceparser.o: spaceparser.h space.h ../textstream/types.h ../utf8/utf8.h
|
||||
spacetojson.o: spacetojson.h space.h ../textstream/types.h
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <wchar.h>
|
||||
#include "space.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "textstream/textstream.h"
|
||||
|
||||
|
||||
|
||||
@@ -396,6 +397,22 @@ return *value;
|
||||
}
|
||||
|
||||
|
||||
std::wstring & Space::FindAdd(const WTextStream & name)
|
||||
{
|
||||
name.to_string(tmp_name);
|
||||
std::wstring * value = GetValue(tmp_name);
|
||||
|
||||
if( !value )
|
||||
{
|
||||
value = &table_single[tmp_name];
|
||||
table.erase(tmp_name);
|
||||
}
|
||||
|
||||
return *value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring & Space::Add(const wchar_t * name, bool value)
|
||||
{
|
||||
if( value )
|
||||
@@ -503,6 +520,46 @@ return val;
|
||||
}
|
||||
|
||||
|
||||
std::wstring & Space::Add(const wchar_t * name, const WTextStream & value)
|
||||
{
|
||||
tmp_name = name;
|
||||
value.to_string(tmp_value_text, true);
|
||||
|
||||
std::wstring & val = table_single[tmp_name];
|
||||
val = tmp_value_text;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring & Space::Add(const std::wstring & name, const WTextStream & value)
|
||||
{
|
||||
tmp_name = name;
|
||||
value.to_string(tmp_value_text, true);
|
||||
|
||||
std::wstring & val = table_single[tmp_name];
|
||||
val = tmp_value_text;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring & Space::Add(const WTextStream & name, const WTextStream & value)
|
||||
{
|
||||
name.to_string(tmp_name, true);
|
||||
value.to_string(tmp_value_text, true);
|
||||
|
||||
std::wstring & val = table_single[tmp_name];
|
||||
val = tmp_value_text;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Space::Remove(const wchar_t * name)
|
||||
{
|
||||
|
@@ -41,6 +41,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "textstream/types.h"
|
||||
|
||||
|
||||
|
||||
namespace PT
|
||||
@@ -215,6 +217,7 @@ public:
|
||||
|
||||
std::wstring & FindAdd(const wchar_t * name);
|
||||
std::wstring & FindAdd(const std::wstring & name);
|
||||
std::wstring & FindAdd(const WTextStream & name);
|
||||
|
||||
std::wstring & Add(const wchar_t * name, bool value);
|
||||
std::wstring & Add(const std::wstring & name, bool value);
|
||||
@@ -228,6 +231,10 @@ public:
|
||||
std::wstring & Add(const wchar_t * name, const std::wstring & value);
|
||||
std::wstring & Add(const std::wstring & name, const std::wstring & value);
|
||||
|
||||
std::wstring & Add(const wchar_t * name, const WTextStream & value);
|
||||
std::wstring & Add(const std::wstring & name, const WTextStream & value);
|
||||
std::wstring & Add(const WTextStream & name, const WTextStream & value);
|
||||
|
||||
void Remove(const wchar_t * name);
|
||||
void Remove(const std::wstring & name);
|
||||
|
||||
@@ -343,8 +350,6 @@ private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::PrintLevel(Stream & out, bool use_indents, int level)
|
||||
{
|
||||
@@ -498,6 +503,7 @@ void Space::Serialize(Stream & out, bool use_indents, bool use_comments, int lev
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
|
@@ -197,8 +197,7 @@ bool is_special;
|
||||
PrintToken(out, i2->first);
|
||||
out << L": ";
|
||||
|
||||
if( i2->second.size() != 1 )
|
||||
out << '[';
|
||||
out << '[';
|
||||
|
||||
for(v = 0 ; v < i2->second.size() ; ++v)
|
||||
{
|
||||
@@ -211,8 +210,7 @@ bool is_special;
|
||||
out << L",\n";
|
||||
}
|
||||
|
||||
if( i2->second.size() != 1 )
|
||||
out << ']';
|
||||
out << ']';
|
||||
|
||||
if( index + 1 < space.table.size() )
|
||||
out << ',';
|
||||
|
Reference in New Issue
Block a user