changed: in plugin 'menu'
menu_dir_tab ezc functions can be nested now
(not finished yet)
added: 'meta' winix function
additional meta information for files and directories
(not finished yet)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@775 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -236,7 +236,8 @@ public:
|
||||
printing the content
|
||||
(for debug purposes)
|
||||
*/
|
||||
void Print(std::wostream & out, int level = 0);
|
||||
template<class Stream>
|
||||
void Serialize(Stream & out, bool use_indents = false, bool use_comments = false, int level = 0) const;
|
||||
|
||||
private:
|
||||
std::wstring tmp_name;
|
||||
@@ -248,12 +249,165 @@ private:
|
||||
bool ToBool(const std::wstring & value);
|
||||
wchar_t ToSmall(wchar_t c);
|
||||
bool EqualNoCase(const wchar_t * str1, const wchar_t * str2);
|
||||
void PrintLevel(std::wostream & out, int level);
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void PrintLevel(Stream & out, bool use_indents, int level) const;
|
||||
|
||||
template<class Stream>
|
||||
void SerializeTableSingle(Stream & out, bool use_indents, int level) const;
|
||||
|
||||
template<class Stream>
|
||||
void SerializeTableMulti(Stream & out, bool use_indents, int level) const;
|
||||
|
||||
template<class Stream>
|
||||
void PrintValue(Stream & out, const std::wstring & str) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::PrintLevel(Stream & out, bool use_indents, int level) const
|
||||
{
|
||||
if( use_indents )
|
||||
{
|
||||
for(int i=0 ; i<level ; ++i)
|
||||
out << ' ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::PrintValue(Stream & out, const std::wstring & str) const
|
||||
{
|
||||
out << '\"';
|
||||
|
||||
for(size_t i=0 ; i<str.size() ; ++i)
|
||||
{
|
||||
if( str[i] == '\\' )
|
||||
out << L"\\\\";
|
||||
else
|
||||
if( str[i] == '"' )
|
||||
out << L"\\\"";
|
||||
else
|
||||
if( str[i] == 0 )
|
||||
out << L"\\0";
|
||||
else
|
||||
out << str[i];
|
||||
}
|
||||
|
||||
out << '\"';
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::SerializeTableSingle(Stream & out, bool use_indents, int level) const
|
||||
{
|
||||
if( !table_single.empty() )
|
||||
{
|
||||
TableSingle::const_iterator i;
|
||||
|
||||
for(i = table_single.begin() ; i != table_single.end() ; ++i)
|
||||
{
|
||||
PrintLevel(out, use_indents, level);
|
||||
out << i->first << L" = ";
|
||||
PrintValue(out, i->second);
|
||||
out << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::SerializeTableMulti(Stream & out, bool use_indents, int level) const
|
||||
{
|
||||
Table::const_iterator i2;
|
||||
size_t v;
|
||||
|
||||
|
||||
if( !table.empty() )
|
||||
{
|
||||
for(i2 = table.begin() ; i2 != table.end() ; ++i2)
|
||||
{
|
||||
PrintLevel(out, use_indents, level);
|
||||
out << i2->first << L" = ";
|
||||
|
||||
if( i2->second.size() != 1 )
|
||||
out << '(';
|
||||
|
||||
for(v = 0 ; v < i2->second.size() ; ++v)
|
||||
{
|
||||
if( v > 0 )
|
||||
PrintLevel(out, use_indents, level + i2->first.size() + 3);
|
||||
|
||||
PrintValue(out, i2->second[v]);
|
||||
|
||||
if( v + 1 < i2->second.size() )
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
if( i2->second.size() != 1 )
|
||||
out << ')';
|
||||
|
||||
out << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
void Space::Serialize(Stream & out, bool use_indents, bool use_comments, int level) const
|
||||
{
|
||||
if( level > 0 )
|
||||
{
|
||||
out << '\n';
|
||||
PrintLevel(out, use_indents, level);
|
||||
|
||||
if( !name.empty() )
|
||||
out << name << ' ';
|
||||
|
||||
out << L"(\n";
|
||||
|
||||
if( use_comments )
|
||||
{
|
||||
PrintLevel(out, use_indents, level);
|
||||
out << L"# space level " << level << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
SerializeTableSingle(out, use_indents, level);
|
||||
SerializeTableMulti(out, use_indents, level);
|
||||
|
||||
for(size_t i=0 ; i<spaces.size() ; ++i)
|
||||
spaces[i]->Serialize(out, use_indents, use_comments, level+1);
|
||||
|
||||
if( level > 0 )
|
||||
{
|
||||
PrintLevel(out, use_indents, level);
|
||||
out << ')';
|
||||
|
||||
if( use_comments )
|
||||
{
|
||||
if( name.empty() )
|
||||
out << L" # end of unnamed space";
|
||||
else
|
||||
out << L" # end of space: " << name;
|
||||
|
||||
out << L" (level " << level << L")";
|
||||
}
|
||||
|
||||
out << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ConfParser
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user