updated to the new Pikotools API

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1071 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-01-06 18:12:53 +00:00
parent 3eff400d88
commit ccf78dcb02
48 changed files with 766 additions and 390 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -166,7 +166,6 @@ bool TicketInfo::ParseTicketConf(long mount_dir_id, const std::wstring & path)
conf_tab[mount_dir_id].file_name = path;
conf_parser.SetSpace(conf_tab[mount_dir_id].conf);
conf_parser.SplitSingle(true);
conf_tab[mount_dir_id].conf.Clear();
return (conf_parser.ParseString(config_file.content) == PT::SpaceParser::ok);
@@ -264,10 +263,15 @@ void TicketInfo::FindCurrentConf()
void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
{
if( space.Text(L"type") == L"integer" )
std::wstring * type = space.GetFirstValue(L"type");
if( !type )
return;
if( *type == L"integer" )
{
std::wstring * min_str = space.GetValue(L"min");
std::wstring * max_str = space.GetValue(L"min");
std::wstring * min_str = space.GetFirstValue(L"min");
std::wstring * max_str = space.GetFirstValue(L"min");
if( min_str )
{
@@ -286,7 +290,7 @@ void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
}
}
else
if( space.Text(L"type") == L"progress" )
if( *type == L"progress" )
{
// !! dodac tez min/max
if( par.intv < 0 )
@@ -296,7 +300,7 @@ void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
par.intv = 100;
}
else
if( space.Text(L"type") == L"select" )
if( *type == L"select" )
{
for(size_t a=0 ; a<space.spaces.size() ; ++a)
{
@@ -306,7 +310,11 @@ void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
return;
}
par.intv = Tol(space.Text(L"default"));
par.intv = 0;
std::wstring * def = space.GetFirstValue(L"default");
if( def )
par.intv = Tol(*def);
}
}
@@ -416,13 +424,15 @@ void TicketInfo::ReadTicketValue(PT::Space & space,
void TicketInfo::ReadTicketValue(PT::Space & space,
long param_id, const PostFile & value, PT::Space & meta)
{
if( space.Text(L"type") == L"images" || space.Text(L"type") == L"files" )
{
std::wstring & upload_path = space.Text(L"upload_dir");
std::wstring * type = space.GetFirstValue(L"type");
if( !upload_path.empty() )
if( type && (*type == L"images" || *type == L"files") )
{
std::wstring * upload_path = space.GetFirstValue(L"upload_dir");
if( upload_path && !upload_path->empty() )
{
Item * upload_dir = system->dirs.GetDir(upload_path);
Item * upload_dir = system->dirs.GetDir(*upload_path);
if( upload_dir )
ReadTicketValue(space, param_id, value, meta, *upload_dir);