Пример #1
0
/**
 * 設定を読み込む
 * 
 * @param config 設定
 * @param bind バインドするか
 */
void DicSubbooks::LoadConfig(wxConfigBase* config, bool bind)
{
	if (!config)
	{
	  	config = wxConfigBase::Get();
	}

	DeleteAll();
	
	config->SetPath(wxT("/dictionary"));
	wxString key;
	long index = 0;
	if (config->GetFirstEntry(key, index))
	{
		do
		{
			DicSubbook* subbook = new DicSubbook();

			wxStringTokenizer tkz(config->Read(key, wxT("")), wxT(";"));

			subbook->SetAlias(tkz.GetNextToken());
			subbook->SetBookPath(tkz.GetNextToken());
			long code;
			tkz.GetNextToken().ToLong(&code);
			subbook->SetSubbookCode((EB_Subbook_Code)code);
			subbook->SetAppendixPath(tkz.GetNextToken());
			
			// bind引数が真の時だけバインドする。
			if (bind)
			{
				if (!subbook->Bind())
				{
					delete subbook;
				}
				else
				{
					Add(subbook);
				}
			}
			else
			{			
				Add(subbook);
			}
		}
		while (config->GetNextEntry(key, index));
	}
}
Пример #2
0
bool wxExMatchesOneOf(const wxFileName& filename, const wxString& pattern)
{
    if (pattern == "*") return true; // asterix matches always.

    const wxString fullname_uppercase = filename.GetFullName().Upper();

    wxStringTokenizer tkz(pattern.Upper(), ";");

    while (tkz.HasMoreTokens())
    {
        const wxString token = tkz.GetNextToken();

        if (fullname_uppercase.Matches(token)) return true;
    }

    return false;
}
Пример #3
0
void IntList::SetList(string str)
{
  wxString wxstr(str.c_str(),wxConvUTF8);
  DeleteList();
  wxStringTokenizer tkz(wxstr, wxT(","));
  while (tkz.HasMoreTokens())
  {
    long value;
    wxString token;
    token = tkz.GetNextToken();
    token.Trim(true);
    token.Trim(false);
    
    if (token.ToLong(&value))
      Add((int)value);
  }
}
Пример #4
0
bool VcImporter::OnProject(const wxString& firstLine, wxString& errMsg)
{
    // first line contains the project name, project file path, and project id
    wxStringTokenizer tkz(firstLine, wxT("="));
    if(tkz.CountTokens() != 2) {
        errMsg = wxT("Invalid 'Project' section found. expected <expr> = <expr>");
        return false;
    }

    tkz.NextToken();
    wxString token = tkz.NextToken();
    TrimString(token);
    wxStringTokenizer tk2(token, wxT(","));
    if(tk2.CountTokens() != 3) {
        errMsg = wxT("Invalid 'Project' section found. expected <project name>, <project file path>, <project id>");
        return false;
    }

    VcProjectData pd;

    pd.name = tk2.NextToken();
    RemoveGershaim(pd.name);

    pd.filepath = tk2.NextToken();
    RemoveGershaim(pd.filepath);

    // Make sure that the project path has a forward slash style
    pd.filepath.Replace(wxT("\\"), wxT("/"));

    pd.id = tk2.NextToken();
    RemoveGershaim(pd.id);

    std::pair<wxString, VcProjectData> p;
    p.first = pd.id;
    p.second = pd;
    m_projects.insert(p);
    // Skip all lines until EndProject section is found
    wxString line;
    while(true) {
        NEXT_LINE(line);
        if(line == wxT("EndProject")) {
            return true;
        }
    }
    return false;
}
Пример #5
0
wxString dlgSearchObject::TranslatePath(wxString &path)
{
	/* Translate a path, but only word that start's with a colon (:) */
	wxStringTokenizer tkz(path, wxT("/"));
	wxString newPath;
	while(tkz.HasMoreTokens())
	{
		wxString token = tkz.GetNextToken();
		if(token.StartsWith(wxT(":")))
		{
			token = wxGetTranslation(token.AfterFirst(':'));
		}
		newPath = newPath + token.Trim() + wxT("/");
	}
	return newPath.BeforeLast('/');

}
Пример #6
0
const std::list < wxString > wxExListFromConfig(
    const wxString& config)
{
    wxStringTokenizer tkz(
        wxConfigBase::Get()->Read(config),
        wxExGetFieldSeparator());

    std::list < wxString > l;

    while (tkz.HasMoreTokens())
    {
        const wxString val = tkz.GetNextToken();
        l.push_back(val);
    }

    return l;
}
Пример #7
0
//===============================
//b4, b3, b2, b1 = ip.split('.')
//long( b4 ) << 24 ) | ( long( b3 ) << 16 ) | ( long( b2 ) << 8 ) | long( b1 )
u_long IpInfo::IpToLong(const wxString &sIp) const
{
  u_long lIp = 0;
  
  wxStringTokenizer tkz(sIp, wxT("."));
  while (tkz.HasMoreTokens()) {
    wxString sToken = tkz.GetNextToken();
  
    u_long lSection;
    sToken.ToULong(&lSection);
    
    lIp += lSection;
    if (tkz.HasMoreTokens())
      lIp *= 256;
  }
  
  return lIp;
}
Пример #8
0
/** Save the current language settings.
 */
void CodeStatConfigDlg::SaveCurrentLanguage()
{
    if (selected_language >= 0)
    {
       wxString extensions;
       extensions = XRCCTRL(*this, "txt_FileTypes", wxTextCtrl)->GetValue();
       extensions.Trim(true); extensions.Trim(false);
       languages[selected_language].ext.Clear();
       wxStringTokenizer tkz(extensions);
       while (tkz.HasMoreTokens())
       {
           languages[selected_language].ext.Add(tkz.GetNextToken());
       }
       languages[selected_language].single_line_comment = XRCCTRL(*this, "txt_SingleComment", wxTextCtrl)->GetValue();
       languages[selected_language].multiple_line_comment[0] = XRCCTRL(*this, "txt_MultiLineCommentBegin", wxTextCtrl)->GetValue();
       languages[selected_language].multiple_line_comment[1] = XRCCTRL(*this, "txt_MultiLineCommentEnd", wxTextCtrl)->GetValue();
    }
}
Пример #9
0
bool clCxxWorkspace::RemoveVirtualDirectory(const wxString& vdFullPath, wxString& errMsg)
{
    wxStringTokenizer tkz(vdFullPath, wxT(":"));
    wxString projName = tkz.GetNextToken();

    wxString fixedPath;
    // Construct new path excluding the first token
    size_t count = tkz.CountTokens();

    for(size_t i = 0; i < count - 1; i++) {
        fixedPath += tkz.GetNextToken();
        fixedPath += wxT(":");
    }
    fixedPath += tkz.GetNextToken();

    ProjectPtr proj = FindProjectByName(projName, errMsg);
    return proj->DeleteVirtualDir(fixedPath);
}
Пример #10
0
int restoreFromDump(mysqlpp::Connection* conn, const wxString& filename)
{
    int toRet = 1;
    wxFFile backup_file(filename);
    if(backup_file.IsOpened())
    {
        wxString fileContent;
        backup_file.ReadAll(&fileContent);
//   wxMessageBox(fileContent);
//wxRegEx comments(_("--[^x22\\x27].*"), wxRE_NEWLINE);
// \x22[^\x22]*\x22|\x27[^\x27]*\x27|/\*.*?\*/|(\#|--)([^\x22\x27]*?)$ - groups 1 and 2
        wxRegEx comments(_("\\x22\\x27[^\\x22\\x27]*\\x22\\x27|/\\*.*?\\*/|(\\#|--)[^\\x22\\x27]*?$"), wxRE_ADVANCED|wxRE_NEWLINE);
//wxRegEx comments(_("\\x22[^\\x22]*\\x22|\\x27[^\\x27]*\\x27|/\\*.*?\\*/|(\\#|--)([^\\x22\\x27]*?)$"), wxRE_ADVANCED|wxRE_NEWLINE);


        comments.ReplaceAll(&fileContent, _(""));
//comments.ReplaceAll(&fileContent, _("*\\2"));

        fileContent.Trim();
        wxRegEx semicolons(_("(?m);\\s*$"), wxRE_ADVANCED|wxRE_NEWLINE);
        semicolons.ReplaceAll(&fileContent, _("^")); //in the future take care of that - if ^ symbol is inside the satatement

//wxMessageBox(fileContent);

        wxStringTokenizer tkz(fileContent, _("^"));
        while ( tkz.HasMoreTokens() )
        {
            wxString sql_query = tkz.GetNextToken().Trim(false);
//wxMessageBox(sql_query);

            mysqlpp::Query query = conn->query();
            query << wx2std(sql_query, wxConvUI);
            query.execute();

        }

    }
    else
    {
        wxMessageBox(_T("Failed to open backup file."));
        toRet = 0;
    }
    return toRet;
}
Пример #11
0
wxXmlNode *Project::CreateVD(const wxString &vdFullPath, bool mkpath)
{
    wxXmlNode *oldVd = GetVirtualDir(vdFullPath);
    if ( oldVd ) {
        // VD already exist
        return oldVd;
    }

    wxStringTokenizer tkz(vdFullPath, wxT(":"));

    wxXmlNode *parent = m_doc.GetRoot();
    size_t count = tkz.CountTokens();
    for (size_t i=0; i<count-1; i++) {
        wxString token = tkz.NextToken();
        wxXmlNode *p = XmlUtils::FindNodeByName(parent, wxT("VirtualDirectory"), token);
        if ( !p ) {
            if ( mkpath ) {

                //add the node
                p = new wxXmlNode(parent, wxXML_ELEMENT_NODE, wxT("VirtualDirectory"));
                p->AddProperty(wxT("Name"), token);

            } else {
                return NULL;
            }
        }
        parent = p;
    }

    wxXmlNode *node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("VirtualDirectory"));
    node->AddProperty(wxT("Name"), tkz.GetNextToken());

    parent->AddChild(node);

    //if not in transaction save the changes
    if (!InTransaction()) {
        SaveXmlFile();
    }

    // cache the result
    m_vdCache[vdFullPath] = node;

    return node;
}
Пример #12
0
void ChatPanel::SetTopic(const wxString& who, const wxString& message)
{
	if (message.empty()) {
		m_topic_set = false;
		return;
	}
	const wxColor col = sett().GetChatColorServer();
	// change the image of the tab to show new events
	if (m_topic_set)
		SetIconHighlight(highlight_say);
	OutputLine(_T("** ") + _("Channel topic"), col);
	wxStringTokenizer tkz(message, _T("\n"));
	while (tkz.HasMoreTokens()) {
		wxString msg = tkz.GetNextToken();
		OutputLine(_T(" ") + msg, col);
	}
	OutputLine(_T("** ") + wxString::Format(_("Set by %s"), who), col);
	m_topic_set = true;
}
Пример #13
0
void TokenizerTestCase::GetCount()
{
    for ( size_t n = 0; n < WXSIZEOF(gs_testData); n++ )
    {
        const TokenizerTestData& ttd = gs_testData[n];

        wxStringTokenizer tkz(ttd.str, ttd.delims, ttd.mode);
        CPPUNIT_ASSERT_EQUAL_MESSAGE( Nth(n), ttd.count, tkz.CountTokens() );

        size_t count = 0;
        while ( tkz.HasMoreTokens() )
        {
            tkz.GetNextToken();
            count++;
        }

        CPPUNIT_ASSERT_EQUAL_MESSAGE( Nth(n), ttd.count, count );
    }
}
Пример #14
0
void
hoxChesscapePlayer::_ParsePlayerStatsString( const wxString&  sStatsStr,
	                                         hoxPlayerStats&  playerStats ) const
{
	wxString delims;
	delims += 0x10;
	// ... Do not return empty tokens
	wxStringTokenizer tkz( sStatsStr, delims, wxTOKEN_STRTOK );
	int tokenPosition = 0;
	wxString token;

	while ( tkz.HasMoreTokens() )
	{
		token = tkz.GetNextToken();
		switch ( tokenPosition++ )
		{
			case 0: /* Id */
				playerStats.id = token; 
				break;

			case 1: /* Score */
                playerStats.score = ::atoi( token.c_str() );
				break;

			case 2: /* Completed Games: Ignored!!! */ break;
            case 3: /* Resigned Games: Ignored!!! */ break;

			case 4: /* Wins */
                playerStats.wins = ::atoi( token.c_str() );
				break;

			case 5: /* Losses */
                playerStats.losses = ::atoi( token.c_str() );
				break;

			case 6: /* Draws */
                playerStats.draws = ::atoi( token.c_str() );
				break;

			default: /* Ignore the rest. */ break;
		}
	}		
}
Пример #15
0
void CodeWriter::FixWrite( wxString s , bool keepIndents)
{
	wxRegEx reIndent( wxT("%TAB%\\s*"), wxRE_ADVANCED );
	wxStringTokenizer tkz( s, wxT("\n"), wxTOKEN_RET_EMPTY_ALL );

	while ( tkz.HasMoreTokens() )
	{
		wxString line = tkz.GetNextToken();
		if(!keepIndents)
		{
			line.Trim( false );
		}
		line.Trim( true );
		// replace indentations defined in code templates by #indent and #unindent macros...
		reIndent.Replace( &line, wxT("\t") );
		WriteLn( line, keepIndents );

	}
}
Пример #16
0
bool CUserItem::setAllowedEventsFromString( const wxString& strEvents )
{
    // Privileges
    if ( strEvents.Length() ) {
        
        m_listAllowedEvents.Clear();
        
        wxStringTokenizer tkz( strEvents, wxT("/") );
        
        do {
            
            wxString str = tkz.GetNextToken();
            m_listAllowedEvents.Add( str );
            
        } while ( tkz.HasMoreTokens() );
    }
    
    return true;
}
Пример #17
0
void 
hoxChesscapePlayer::_HandleCmd_Clients( const wxString& cmdStr )
{
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // NOTE: This command is sent only ONCE from the server
    //       upon login to send the list of all ONLINE players.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	/* Create a new player-list. */

	wxString delims;
	delims += 0x10;   // delimiter
	wxStringTokenizer tkz( cmdStr, delims, wxTOKEN_STRTOK ); // No empty tokens
	wxString token;
    int tokenPosition = 0;
    wxString sPlayerId;
    int      nPlayerScore = 0;
    hoxPlayerStatus playerStatus = hoxPLAYER_STATUS_UNKNOWN;
	
    while ( tkz.HasMoreTokens() )
	{
		token = tkz.GetNextToken();
   		switch ( tokenPosition++ )
		{
        case 0:  /* Player-Id */
            sPlayerId = token;
            break;
        
        case 1:  /* Player-Score */
            nPlayerScore = ::atoi( token.c_str() );
            break;
        
        case 2:  /* Player-Status */
            playerStatus = _StringToPlayerStatus( token );
            m_site->OnPlayerLoggedIn( sPlayerId, nPlayerScore, playerStatus );
            tokenPosition = 0;  // Reset for the next player!!!
            break;

        default:
            wxFAIL_MSG("!!! Should never reach here !!!");
        };
	}
}
Пример #18
0
bool FileCSV::Load(const wxString& fileName, unsigned int itemsInLine)
{
    // Make sure file exists
    if (fileName.IsEmpty() || !wxFileName::FileExists(fileName))
    {
        mmErrorDialogs::InvalidFile(pParentWindow_);
        return false;
    }

    // Open file
    wxTextFile txtFile(fileName);
    if (!txtFile.Open(encoding_))
    {
        mmErrorDialogs::MessageError(pParentWindow_, _("Unable to open file."), _("Universal CSV Import"));
        return false;
    }

    // Parse rows
    wxString line;
    int row = 0;
    for (line = txtFile.GetFirstLine(); !txtFile.Eof(); line = txtFile.GetNextLine())
    {
        csv2tab_separated_values(line, delimiter_);
        wxStringTokenizer tkz(line, "\t", wxTOKEN_RET_EMPTY_ALL);
        itemsTable_.push_back(std::vector<ValueAndType>());

        // Tokens in row
        while (tkz.HasMoreTokens())
        {
            if (itemsTable_[row].size() >= itemsInLine)
                break;

            wxString token = tkz.GetNextToken();
            itemsTable_[row].push_back(token);
        }

        ++row;
    }

    txtFile.Close();
    return true;
}
Пример #19
0
void PHPSetterGetterEntry::FormatName(wxString& name) const
{
    if(name.StartsWith(wxT("m_"))) {
        name = name.Mid(2);

    } else if(name.StartsWith(wxT("_"))) {
        name = name.Mid(1);
    }

    wxStringTokenizer tkz(name, wxT("_"));
    name.Clear();
    while(tkz.HasMoreTokens()) {
        wxString token = tkz.NextToken();
        wxString pre = token.Mid(0, 1);
        token.Remove(0, 1);
        pre.MakeUpper();
        token.Prepend(pre);
        name << token;
    }
}
Пример #20
0
// count the number of (remaining) tokens in the string
size_t wxStringTokenizer::CountTokens() const
{
    wxCHECK_MSG( IsOk(), 0, _T("you should call SetString() first") );

    // VZ: this function is IMHO not very useful, so it's probably not very
    //     important if its implementation here is not as efficient as it
    //     could be -- but OTOH like this we're sure to get the correct answer
    //     in all modes
    wxStringTokenizer tkz(m_string.c_str() + m_pos, m_delims, m_mode);

    size_t count = 0;
    while ( tkz.HasMoreTokens() )
    {
        count++;

        (void)tkz.GetNextToken();
    }

    return count;
}
Пример #21
0
// ----------------------------------------------------------------------------
bool BrowseTrackerLayout::ParseBrowse_MarksString(const wxString& filename, wxString BrowseMarksString, FileBrowse_MarksHash& m_EdMarksArchive)
// ----------------------------------------------------------------------------
{
    if (filename.IsEmpty()) return false;
    if ( BrowseMarksString.IsEmpty() ) return false;
    ProjectFile* pf = m_pProject->GetFileByFilename( filename, true, true);
    if ( not pf ) return false;
    wxString filenamePath = pf->file.GetFullPath();

   // parse the comma delimited string
    BrowseMarks*  pEdPosnArchive = new BrowseMarks(filenamePath );
    wxStringTokenizer tkz(BrowseMarksString, wxT(","));
    while ( tkz.HasMoreTokens() )
    {   long longnum;
        tkz.GetNextToken().ToLong(&longnum);
        pEdPosnArchive->RecordMark(longnum);
    }//while
    m_EdMarksArchive[filenamePath] = pEdPosnArchive;
    return true;
}//ParseBrowse_MarksString
Пример #22
0
bool CVSCPBTDetect::open( const char *pUsername,
                            const char *pPassword,
                            const char *pHost,
                            short port,
                            const char *pPrefix,
                            const char *pConfig, 
                            unsigned long flags )
{
    bool rv = true;
    m_flags = flags;
    wxString wxstr = pConfig;

    m_username = pUsername;
    m_password = pPassword;
    m_host = pHost;
    m_port = port;
    m_prefix = pPrefix;

    // Parse the configuration string. It should
    // have the following form
    // username;password;host;prefix;port;filename
    wxStringTokenizer tkz( pConfig, ";\n" );

    // Filename
    //if ( tkz.HasMoreTokens() ) {
    //    m_path = tkz.GetNextToken();     
    //}

    // start the workerthread
    m_pthreadWork = new CVSCPBTDetectWrkTread();
    if ( NULL != m_pthreadWork ) {
        m_pthreadWork->m_pobj = this;
        m_pthreadWork->Create();
        m_pthreadWork->Run();
    }
    else {
        rv = false;
    }

	return rv;
}
Пример #23
0
bool CUserItem::isAllowedToConnect(const wxString& remote)
{
    unsigned int i;
    wxString wxstr;
    wxIPV4address ipaddr;
    if ( !ipaddr.Hostname( remote ) ) return false;

    // If empty all host allowed, This is "*.*.*.*" or "*"
    if ( m_listAllowedIPV4Remotes.IsEmpty() ) return true;

    for (i = 0; i < m_listAllowedIPV4Remotes.GetCount(); i++) {
        wxLogDebug(m_listAllowedIPV4Remotes[ i ]);
        if (m_listAllowedIPV4Remotes[ i ].IsSameAs(remote)) return true;
    }

    wxStringTokenizer tkz(ipaddr.IPAddress(), wxT("."));
    wxString ip1 = tkz.GetNextToken();
    wxString ip2 = tkz.GetNextToken();
    wxString ip3 = tkz.GetNextToken();
    wxString ip4 = tkz.GetNextToken();

    // test wildcard a.b.c.*
    wxstr.Printf(_("%s.%s.%s.*"), ip1.c_str(), ip2.c_str(), ip3.c_str());
    for (i = 0; i < m_listAllowedIPV4Remotes.GetCount(); i++) {
        if (m_listAllowedIPV4Remotes[ i ].IsSameAs(wxstr)) return true;
    }

    // test wildcard a.b.*.*
    wxstr.Printf(_("%s.%s.*.*"), ip1.c_str(), ip2.c_str());
    for (i = 0; i < m_listAllowedIPV4Remotes.GetCount(); i++) {
        if (m_listAllowedIPV4Remotes[ i ].IsSameAs(wxstr)) return true;
    }

    // test wildcard a.*.*.*
    wxstr.Printf(_("%s.*.*.*"), ip1.c_str());
    for (i = 0; i < m_listAllowedIPV4Remotes.GetCount(); i++) {
        if (m_listAllowedIPV4Remotes[ i ].IsSameAs(wxstr)) return true;
    }

    return false;
}
Пример #24
0
ContextBasePtr ContextManager::NewContextByFileName (LEditor *parent, const wxFileName &fileName)
{
	EditorConfig::ConstIterator iter = EditorConfigST::Get()->LexerBegin();
	for ( ; iter != EditorConfigST::Get()->LexerEnd(); iter++ ) {
		LexerConfPtr lexer = iter->second;
		wxString lexExt = lexer->GetFileSpec();
		wxStringTokenizer tkz ( lexExt, wxT ( ";") );
		while ( tkz.HasMoreTokens() ) {
			wxString ext      = tkz.NextToken();
			wxString fullname = fileName.GetFullName();

			ext.MakeLower(); fullname.MakeLower();
			if ( wxMatchWild ( ext, fullname ) ) {
				return ContextManager::Get()->NewContext ( parent, lexer->GetName() );
			}
		}
	}

	// return the default context
	return ContextManager::Get()->NewContext ( parent, wxT ( "Text") );
}
Пример #25
0
void 
hoxChesscapePlayer::_HandleTableCmd_PastMoves( hoxTable_SPtr   pTable,
	                                           const wxString& cmdStr )
{
    hoxStringList moves;

    /* Get the list of Past Moves. */

	wxString delims;
	delims += 0x10;   // move-delimiter
	wxStringTokenizer tkz( cmdStr, delims, wxTOKEN_STRTOK ); // No empty tokens
	wxString moveStr;
	while ( tkz.HasMoreTokens() )
	{
		moveStr = tkz.GetNextToken();
		wxLogDebug("%s: .... move-str=[%s].", __FUNCTION__, moveStr.c_str());
        moves.push_back( moveStr );
	}

    pTable->OnPastMoves( moves );
}
Пример #26
0
wxDword wxGISAcceleratorTable::GetFlags(wxString sFlags)
{
    wxDword Flags(0);
	wxStringTokenizer tkz(sFlags, wxString(wxT("|")), wxTOKEN_RET_EMPTY );
	while ( tkz.HasMoreTokens() )
	{
		wxString token = tkz.GetNextToken();
		//token.Replace(wxT("|"), wxT(""));
		token.MakeUpper();
		// process token here
		if(token == wxString(wxT("NORMAL")))
			Flags |= wxACCEL_NORMAL;
		else if(token == wxString(wxT("ALT")))
			Flags |= wxACCEL_ALT;
		else if(token == wxString(wxT("CTRL")))
			Flags |= wxACCEL_CTRL;
		else if(token == wxString(wxT("SHIFT")))
			Flags |= wxACCEL_SHIFT;
	}
	return Flags;
}
Пример #27
0
 // Load data
 void LoadData(const wxString& file, wxArrayPtrVoid& data)
 {
   // Read file lines
   wxFileInputStream f(file);
   wxTextInputStream text( f );
   wxString line;
   while (!f.Eof())
   {
     text >> line;
     if (!f.Eof() && line.Length() > 0)
     {
       wxArrayString* row = new wxArrayString;
       data.Add(row);
       wxStringTokenizer tkz(line, wxS(";"));
       while ( tkz.HasMoreTokens() )
       {
         wxString token = tkz.GetNextToken();
         row->Add(token);
       }
     }
   }
 }
Пример #28
0
int RazdsParser::ParseLBID( FILE *fp )
{

    wxString s( pBuf, wxConvUTF8 );
    wxStringTokenizer tkz( s, _T ( '\037' ) );

    wxString token = tkz.GetNextToken(); // something like "113LI00001REVIHO"
    token = tkz.GetNextToken(); // ESID
    token = tkz.GetNextToken();

    //    Get PLIB version number
    double version;
    if( token.ToDouble( &version ) ) {
        plib->m_VersionMajor = ( (int) ( version * 10 ) ) / 10;
        plib->m_VersionMinor = (int) floor( ( ( version - plib->m_VersionMajor ) * 10 ) + 0.5 );
    } else {
        plib->m_VersionMajor = 0;
        plib->m_VersionMinor = 0;
    }

    return 1;
}
Пример #29
0
bool CUserItem::setUserRightsFromString( const wxString& strRights )
{
    // Privileges
    if ( strRights.Length() ) {
        
        wxStringTokenizer tkz( strRights, wxT("/") );
        
        int idx=0;
        do {
            
            wxString str = tkz.GetNextToken();
            if (str.IsSameAs(_("admin"), false)) {
                // All rights
                //memset( m_userRights, 0xff, sizeof( m_userRights ) );
                // All rights
                for (int i= 0; i<USER_PRIVILEGE_BYTES; i++ ) {
                    setUserRights( i, 0xff );
                }
            } 
            else if (str.IsSameAs(_("user"), false)) {
                // A standard user
                setUserRights( 0, 0x06 );
            } 
            else if (str.IsSameAs(_("driver"), false)) {
                // A standard driver
                setUserRights( 0, 0x0f );
            } 
            else {
                // Numerical
                unsigned long lval;
                str.ToULong( &lval );
                setUserRights( idx++, (uint8_t)lval );
            }
            
        } while ( tkz.HasMoreTokens() && ( idx < sizeof( m_userRights ) ) );
    }
    
    return true;
}
Пример #30
0
void FileList::Init(const wxString& files)
{
	m_files = files;

	wxStringTokenizer tkzfiledescs(files,  wxT("|"));
	while (tkzfiledescs.HasMoreTokens())
	{
		wxStringTokenizer tkz(tkzfiledescs.GetNextToken(), wxT("<"));

		wxString file = tkz.GetNextToken();

		LineNumberList bmklns;
		while (tkz.HasMoreTokens())
		{
			unsigned long ln = 0;
			if (tkz.GetNextToken().ToULong(&ln))
				bmklns.push_back((size_t)ln);
		}

		m_filevec.push_back(FileDesc(file, bmklns));
	}
}