/// called on opening tag < virtual ldomNode * OnTagOpen( const lChar16 * nsname, const lChar16 * tagname) { if (!lStr_cmp(tagname, L"encryption")) insideEncryption = true; else if (!lStr_cmp(tagname, L"EncryptedData")) insideEncryptedData = true; else if (!lStr_cmp(tagname, L"EncryptionMethod")) insideEncryptionMethod = true; else if (!lStr_cmp(tagname, L"CipherData")) insideCipherData = true; else if (!lStr_cmp(tagname, L"CipherReference")) insideCipherReference = true; return NULL; }
int CREncodingNameToId( const lChar16 * enc_name ) { lString16 s( enc_name ); s.lowercase(); const lChar16 * encoding_name = s.c_str(); if ( !lStr_cmp(encoding_name, L"utf-8") ) return CRENC_ID_UTF8; else if ( !lStr_cmp(encoding_name, L"utf-16") ) return CRENC_ID_UTF16_LE; else if ( !lStr_cmp(encoding_name, L"utf-16le") ) return CRENC_ID_UTF16_LE; else if ( !lStr_cmp(encoding_name, L"utf-16be") ) return CRENC_ID_UTF16_BE; else if ( !lStr_cmp(encoding_name, L"utf-32") ) return CRENC_ID_UTF16_LE; else if ( !lStr_cmp(encoding_name, L"utf-32le") ) return CRENC_ID_UTF16_LE; else if ( !lStr_cmp(encoding_name, L"utf-32be") ) return CRENC_ID_UTF16_BE; for (int i=0; _enc_table[i].name!=NULL; i++) { if ( !lStr_cmp(encoding_name, _enc_table[i].name) ) { return _enc_table[i].id; } } return CRENC_ID_UNKNOWN; // not found }
/// called on tag close virtual void OnTagClose( const lChar16 * nsname, const lChar16 * tagname ) { if (!lStr_cmp(tagname, L"encryption")) insideEncryption = false; else if (!lStr_cmp(tagname, L"EncryptedData") && insideEncryptedData) { if (!algorithm.empty() && !uri.empty()) { _container->addEncryptedItem(new EncryptedItem(uri, algorithm)); } insideEncryptedData = false; } else if (!lStr_cmp(tagname, L"EncryptionMethod")) insideEncryptionMethod = false; else if (!lStr_cmp(tagname, L"CipherData")) insideCipherData = false; else if (!lStr_cmp(tagname, L"CipherReference")) insideCipherReference = false; }
/// called on opening tag virtual ldomNode * OnTagOpen( const lChar16 * nsname, const lChar16 * tagname) { if (!lStr_cmp(tagname, "pattern")) { insidePatternTag = true; } return NULL; }
virtual LVStreamRef OpenStream( const lChar16 * fname, lvopen_mode_t mode ) { if ( mode!=LVOM_READ ) return LVStreamRef(); for ( int i=0; i<_list.length(); i++ ) { //CRLog::trace("OpenStream(%s) : %s", LCSTR(lString16(fname)), LCSTR(lString16(_list[i]->GetName())) ); if ( !lStr_cmp(_list[i]->GetName(), fname) ) return _list[i]->openStream(); } return LVStreamRef(); }
const lChar16 * GetCharsetByte2UnicodeTable( const lChar16 * enc_name ) { lString16 s( enc_name ); s.lowercase(); const lChar16 * encoding_name = s.c_str(); for (int i=0; _enc_table[i].name!=NULL; i++) { if ( !lStr_cmp(encoding_name, _enc_table[i].name) ) { return _enc_table[i].table; } } return NULL; // not found }
const LDOMNameIdMapItem * LDOMNameIdMap::findItem( const lChar8 * name ) { if (m_count==0 || !name || !*name) return NULL; if (!m_sorted) Sort(); lUInt16 a, b, c; int r; a = 0; b = m_count; for (;;) { c = (a + b)>>1; r = lStr_cmp( name, m_by_name[c]->value.c_str() ); if (r == 0) return m_by_name[c]; // found if (b==a+1) return NULL; // not found if (r>0) { a = c; } else { b = c; } } }
/// called on element attribute virtual void OnAttribute( const lChar16 * nsname, const lChar16 * attrname, const lChar16 * attrvalue ) { CR_UNUSED(nsname); if ( lStr_cmp(attrname, "type")==0 && state==in_bm ) { static const char * tnames[] = {"lastpos", "position", "comment", "correction"}; for ( int i=0; i<4; i++) { if ( lStr_cmp(attrvalue, tnames[i])==0 ) { _curr_bookmark->setType( (bmk_type)i ); return; } } } else if ( lStr_cmp(attrname, "shortcut")==0 && state==in_bm ) { int n = lString16( attrvalue ).atoi(); _curr_bookmark->setShortcut( n ); } else if ( lStr_cmp(attrname, "percent")==0 && state==in_bm ) { int n1=0, n2=0; int i=0; for ( ; attrvalue[i]>='0' && attrvalue[i]<='9'; i++) n1 = n1*10 + (attrvalue[i]-'0'); if ( attrvalue[i]=='.' ) { i++; if (attrvalue[i]>='0' && attrvalue[i]<='9') n2 = (attrvalue[i++]-'0')*10; if (attrvalue[i]>='0' && attrvalue[i]<='9') n2 = (attrvalue[i++]-'0'); } _curr_bookmark->setPercent( n1*100 + n2 ); } else if ( lStr_cmp(attrname, "timestamp")==0 && state==in_bm ) { time_t n1=0; int i=0; for ( ; attrvalue[i]>='0' && attrvalue[i]<='9'; i++) n1 = n1*10 + (attrvalue[i]-'0'); _curr_bookmark->setTimestamp( n1 ); } else if (lStr_cmp(attrname, "page")==0 && state==in_bm) { _curr_bookmark->setBookmarkPage(lString16( attrvalue ).atoi()); } }
/// called on element attribute virtual void OnAttribute( const lChar16 * nsname, const lChar16 * attrname, const lChar16 * attrvalue ) { if (!lStr_cmp(attrname, L"URI") && insideCipherReference) insideEncryption = false; else if (!lStr_cmp(attrname, L"Algorithm") && insideEncryptionMethod) insideEncryptedData = false; }
int cmp( TexPattern * v ) { return lStr_cmp( word, v->word ); }
/// called on opening tag virtual ldomNode * OnTagOpen( const lChar16 * nsname, const lChar16 * tagname) { CR_UNUSED(nsname); if ( lStr_cmp(tagname, "FictionBookMarks")==0 && state==in_xml ) { state = in_fbm; } else if ( lStr_cmp(tagname, "file")==0 && state==in_fbm ) { state = in_file; _curr_file = new CRFileHistRecord(); } else if ( lStr_cmp(tagname, "file-info")==0 && state==in_file ) { state = in_file_info; } else if ( lStr_cmp(tagname, "bookmark-list")==0 && state==in_file ) { state = in_bm_list; } else if ( lStr_cmp(tagname, "doc-title")==0 && state==in_file_info ) { state = in_title; } else if ( lStr_cmp(tagname, "doc-author")==0 && state==in_file_info ) { state = in_author; } else if ( lStr_cmp(tagname, "doc-series")==0 && state==in_file_info ) { state = in_series; } else if ( lStr_cmp(tagname, "doc-filename")==0 && state==in_file_info ) { state = in_filename; } else if ( lStr_cmp(tagname, "doc-filepath")==0 && state==in_file_info ) { state = in_filepath; } else if ( lStr_cmp(tagname, "doc-filesize")==0 && state==in_file_info ) { state = in_filesize; } else if ( lStr_cmp(tagname, "bookmark")==0 && state==in_bm_list ) { state = in_bm; _curr_bookmark = new CRBookmark(); } else if ( lStr_cmp(tagname, "start-point")==0 && state==in_bm ) { state = in_start_point; } else if ( lStr_cmp(tagname, "end-point")==0 && state==in_bm ) { state = in_end_point; } else if ( lStr_cmp(tagname, "header-text")==0 && state==in_bm ) { state = in_header_txt; } else if ( lStr_cmp(tagname, "selection-text")==0 && state==in_bm ) { state = in_selection_txt; } else if ( lStr_cmp(tagname, "comment-text")==0 && state==in_bm ) { state = in_comment_txt; } return NULL; }
/// called on closing virtual void OnTagClose( const lChar16 * nsname, const lChar16 * tagname ) { if ( lStr_cmp(nsname, "FictionBookMarks")==0 && state==in_fbm ) { state = in_xml; } else if ( lStr_cmp(tagname, "file")==0 && state==in_file ) { state = in_fbm; if ( _curr_file ) _hist->getRecords().add( _curr_file ); _curr_file = NULL; } else if ( lStr_cmp(tagname, "file-info")==0 && state==in_file_info ) { state = in_file; } else if ( lStr_cmp(tagname, "bookmark-list")==0 && state==in_bm_list ) { state = in_file; } else if ( lStr_cmp(tagname, "doc-title")==0 && state==in_title ) { state = in_file_info; } else if ( lStr_cmp(tagname, "doc-author")==0 && state==in_author ) { state = in_file_info; } else if ( lStr_cmp(tagname, "doc-series")==0 && state==in_series ) { state = in_file_info; } else if ( lStr_cmp(tagname, "doc-filename")==0 && state==in_filename ) { state = in_file_info; } else if ( lStr_cmp(tagname, "doc-filepath")==0 && state==in_filepath ) { state = in_file_info; } else if ( lStr_cmp(tagname, "doc-filesize")==0 && state==in_filesize ) { state = in_file_info; } else if ( lStr_cmp(tagname, "bookmark")==0 && state==in_bm ) { state = in_bm_list; if ( _curr_bookmark ) { if ( _curr_bookmark->getType() == bmkt_lastpos ) { _curr_file->setLastPos(_curr_bookmark); delete _curr_bookmark; } else { _curr_file->getBookmarks().add(_curr_bookmark); } _curr_bookmark = NULL; } } else if ( lStr_cmp(tagname, "start-point")==0 && state==in_start_point ) { state = in_bm; } else if ( lStr_cmp(tagname, "end-point")==0 && state==in_end_point ) { state = in_bm; } else if ( lStr_cmp(tagname, "header-text")==0 && state==in_header_txt ) { state = in_bm; } else if ( lStr_cmp(tagname, "selection-text")==0 && state==in_selection_txt ) { state = in_bm; } else if ( lStr_cmp(tagname, "comment-text")==0 && state==in_comment_txt ) { state = in_bm; } }