(added some header files) added: three messsages in ticket plugin: // send by showtickets winix function when tickets are loaded (and sorted) // in p1 you have a pointer to the ticket tab: std::vector<Ticket::Ticket> (include "ticket.h") // in p2 you have a pointer to the sort tab: std::vector<Item*> // those tables don't have to be equal in size (in the case when there is no some tickets in the database) #define WINIX_PL_TICKET_TICKETS_LOADED 4106 // a new ticket has been added // in p1 you have a pointer to the Ticket::Ticket structure (include "ticket.h") // in p2 you have a pointer to the Item structure #define WINIX_PL_TICKET_ADDED_NEW 4107 // a ticket has been changed // in p1 you have a pointer to the Ticket::Ticket structure (include "ticket.h") // in p2 you have a pointer to the Item structure #define WINIX_PL_TICKET_CHANGED 4108 added: two ezc functions for tickets: ticket_does_param_id_have_value() tickets_tab_does_param_id_have_value() (they take two integer arguments -- testing whether a specified param_id has the given value) changed: some more minor additions in tickets templates git-svn-id: svn://ttmath.org/publicrep/winix/trunk@932 e52654a7-88a9-db11-a3e9-0013d4bc506e
115 lines
1.4 KiB
C++
Executable File
115 lines
1.4 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2013, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include <cstdlib>
|
|
#include "acceptbaseparser.h"
|
|
|
|
|
|
|
|
bool AcceptBaseParser::IsWhite(int c)
|
|
{
|
|
if( c==' ' || c=='\t' )
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
void AcceptBaseParser::SkipWhite()
|
|
{
|
|
while( IsWhite(*text) )
|
|
++text;
|
|
}
|
|
|
|
|
|
void AcceptBaseParser::RemoveWhiteFromEnd(std::string & str)
|
|
{
|
|
if( str.empty() )
|
|
return;
|
|
|
|
size_t i = str.size() - 1;
|
|
|
|
for( ; i!=0 && IsWhite(str[i]) ; --i);
|
|
|
|
if( !IsWhite(str[i]) )
|
|
++i;
|
|
|
|
if( i < str.size() )
|
|
str.erase(i); // erasing until the end of the string
|
|
}
|
|
|
|
|
|
|
|
void AcceptBaseParser::ReadParameter()
|
|
{
|
|
param.clear();
|
|
|
|
SkipWhite();
|
|
|
|
while( *text!=0 && *text!=',' && *text!=';' )
|
|
{
|
|
param += *text;
|
|
++text;
|
|
}
|
|
|
|
RemoveWhiteFromEnd(param);
|
|
}
|
|
|
|
|
|
void AcceptBaseParser::ReadQ()
|
|
{
|
|
q = 1.0;
|
|
|
|
SkipWhite();
|
|
|
|
if( *text != ';' )
|
|
return;
|
|
|
|
++text; // skipping a semicolon
|
|
|
|
while( *text!=0 && *text!=',' && *text!='=' )
|
|
// skipping until ',' or '='
|
|
++text;
|
|
|
|
if( *text==0 || *text==',' )
|
|
return;
|
|
|
|
++text; // skipping '='
|
|
|
|
SkipWhite();
|
|
q = strtod(text, (char**)&text);
|
|
}
|
|
|
|
|
|
void AcceptBaseParser::SkipParam()
|
|
{
|
|
SkipWhite();
|
|
|
|
if( *text == ',' )
|
|
++text;
|
|
}
|
|
|
|
|
|
|
|
void AcceptBaseParser::Parse(const char * str)
|
|
{
|
|
text = str;
|
|
Init();
|
|
|
|
while( *text != 0 )
|
|
{
|
|
ReadParameter();
|
|
ReadQ();
|
|
SkipParam();
|
|
Param(param, q);
|
|
}
|
|
}
|
|
|
|
|