本文整理汇总了C++中LVContainerRef::GetObjectInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ LVContainerRef::GetObjectInfo方法的具体用法?C++ LVContainerRef::GetObjectInfo怎么用?C++ LVContainerRef::GetObjectInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LVContainerRef
的用法示例。
在下文中一共展示了LVContainerRef::GetObjectInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDirectoryFonts
bool getDirectoryFonts( lString16Collection & pathList, lString16 ext, lString16Collection & fonts, bool absPath )
{
int foundCount = 0;
lString16 path;
for (int di=0; di<pathList.length();di++ ) {
path = pathList[di];
LVContainerRef dir = LVOpenDirectory(path.c_str());
if(!dir.isNull()) {
CRLog::trace("Checking directory %s", UnicodeToUtf8(path).c_str() );
for(int i=0; i < dir->GetObjectCount(); i++ ) {
const LVContainerItemInfo * item = dir->GetObjectInfo(i);
lString16 fileName = item->GetName();
if ( !item->IsContainer() && fileName.length()>4 && lString16(fileName, fileName.length()-4, 4)==ext ) {
lString16 fn;
if ( absPath ) {
fn = path;
if (!fn.empty() && fn[fn.length()-1]!=PATH_SEPARATOR_CHAR)
fn << PATH_SEPARATOR_CHAR;
}
fn << fileName;
foundCount++;
fonts.add(fn);
}
}
}
}
return foundCount > 0;
}
示例2: open
bool HyphDictionaryList::open(lString16 hyphDirectory, bool clear)
{
CRLog::info("HyphDictionaryList::open(%s)", LCSTR(hyphDirectory) );
if (clear) {
_list.clear();
addDefault();
}
if ( hyphDirectory.empty() )
return true;
//LVAppendPathDelimiter( hyphDirectory );
LVContainerRef container;
LVStreamRef stream;
if ( (hyphDirectory.endsWith("/") || hyphDirectory.endsWith("\\")) && LVDirectoryExists(hyphDirectory) ) {
container = LVOpenDirectory( hyphDirectory.c_str(), L"*.*" );
} else if ( LVFileExists(hyphDirectory) ) {
stream = LVOpenFileStream( hyphDirectory.c_str(), LVOM_READ );
if ( !stream.isNull() )
container = LVOpenArchieve( stream );
}
if ( !container.isNull() ) {
int len = container->GetObjectCount();
int count = 0;
CRLog::info("%d items found in hyph directory", len);
for ( int i=0; i<len; i++ ) {
const LVContainerItemInfo * item = container->GetObjectInfo( i );
lString16 name = item->GetName();
lString16 suffix;
HyphDictType t = HDT_NONE;
if ( name.endsWith(".pdb") ) {
suffix = "_hyphen_(Alan).pdb";
t = HDT_DICT_ALAN;
} else if ( name.endsWith(".pattern") ) {
suffix = ".pattern";
t = HDT_DICT_TEX;
} else
continue;
lString16 filename = hyphDirectory + name;
lString16 id = name;
lString16 title = name;
if ( title.endsWith( suffix ) )
title.erase( title.length() - suffix.length(), suffix.length() );
_list.add( new HyphDictionary( t, title, id, filename ) );
count++;
}
CRLog::info("%d dictionaries added to list", _list.length());
return true;
} else {
CRLog::info("no hyphenation dictionary items found in hyph directory %s", LCSTR(hyphDirectory));
}
return false;
}
示例3: indexExt
//TODO: place TinyDictionary to separate file
CRTinyDict::CRTinyDict( const lString16& config )
{
lString16 path = config;
LVAppendPathDelimiter( path );
LVContainerRef dir = LVOpenDirectory( config.c_str() );
if ( !dir )
dir = LVOpenDirectory( LVExtractPath(config).c_str() );
if ( !dir.isNull() ) {
int count = dir->GetSize();
lString16 indexExt(".index");
for ( int i=0; i<count; i++ ) {
const LVContainerItemInfo * item = dir->GetObjectInfo( i );
if ( !item->IsContainer() ) {
lString16 name = item->GetName();
if ( name.endsWith( indexExt ) ) {
lString16 nameBase = name.substr( 0, name.length() - indexExt.length() );
lString16 name1 = nameBase + ".dict";
lString16 name2 = nameBase + ".dict.dz";
lString16 dataName;
int index = -1;
for ( int n=0; n<count; n++ ) {
const LVContainerItemInfo * item2 = dir->GetObjectInfo( n );
if ( !item2->IsContainer() ) {
if ( item2->GetName() == name1 || item2->GetName() == name2 ) {
index = n;
dataName = item2->GetName();
break;
}
}
}
if ( index>=0 ) {
// found pair
dicts.add(UnicodeToUtf8(path + name).c_str(), UnicodeToUtf8(path + dataName).c_str());
}
}
}
}
}
CRLog::info( "%d dictionaries opened", dicts.length() );
}
示例4: findImagesFromDirectory
static void findImagesFromDirectory( lString16 dir, lString16Collection & files ) {
LVAppendPathDelimiter(dir);
if ( !LVDirectoryExists(dir) )
return;
LVContainerRef cont = LVOpenDirectory(dir.c_str());
if ( !cont.isNull() ) {
for ( int i=0; i<cont->GetObjectCount(); i++ ) {
const LVContainerItemInfo * item = cont->GetObjectInfo(i);
if ( !item->IsContainer() ) {
lString16 name = item->GetName();
name.lowercase();
if ( name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".gif")
|| name.endsWith(".jpeg") ) {
files.add(dir + item->GetName());
}
}
}
}
}
示例5: dumpZip
static void dumpZip( LVContainerRef arc ) {
lString16 arcName = LVExtractFilenameWithoutExtension( arc->GetName() );
if ( arcName.empty() )
arcName = L"unziparc";
lString16 outDir = lString16("/tmp/") + arcName;
LVCreateDirectory(outDir);
for ( int i=0; i<arc->GetObjectCount(); i++ ) {
const LVContainerItemInfo * info = arc->GetObjectInfo(i);
if ( !info->IsContainer() ) {
lString16 outFileName = outDir + L"/" + info->GetName();
LVCreateDirectory(LVExtractPath(outFileName));
LVStreamRef in = arc->OpenStream(info->GetName(), LVOM_READ);
LVStreamRef out = LVOpenFileStream(outFileName.c_str(), LVOM_WRITE);
if ( !in.isNull() && !out.isNull() ) {
CRLog::trace("Writing %s", LCSTR(outFileName));
LVPumpStream(out.get(), in.get());
}
}
}
}
示例6: getDirectoryFonts
bool getDirectoryFonts( lString16Collection & pathList, lString16Collection & ext, lString16Collection & fonts, bool absPath )
{
int foundCount = 0;
lString16 path;
for ( int di=0; di<pathList.length();di++ ) {
path = pathList[di];
LVContainerRef dir = LVOpenDirectory(path.c_str());
if ( !dir.isNull() ) {
CRLog::trace("Checking directory %s", UnicodeToUtf8(path).c_str() );
for ( int i=0; i < dir->GetObjectCount(); i++ ) {
const LVContainerItemInfo * item = dir->GetObjectInfo(i);
lString16 fileName = item->GetName();
lString8 fn = UnicodeToLocal(fileName);
//printf(" test(%s) ", fn.c_str() );
if ( !item->IsContainer() ) {
bool found = false;
lString16 lc = fileName;
lc.lowercase();
for ( int j=0; j<ext.length(); j++ ) {
if ( lc.endsWith(ext[j]) ) {
found = true;
break;
}
}
if ( !found )
continue;
lString16 fn;
if ( absPath ) {
fn = path;
if ( !fn.empty() && fn[fn.length()-1]!=PATH_SEPARATOR_CHAR)
fn << PATH_SEPARATOR_CHAR;
}
fn << fileName;
foundCount++;
fonts.add( fn );
}
}
}
}
return foundCount > 0;
}
示例7: env
/*
* Class: org_coolreader_crengine_Engine
* Method: getArchiveItemsInternal
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_coolreader_crengine_Engine_getArchiveItemsInternal
(JNIEnv * _env, jclass, jstring jarcName)
{
CRJNIEnv env(_env);
lString16 arcName = env.fromJavaString(jarcName);
lString16Collection list;
//fontMan->getFaceList(list);
LVStreamRef stream = LVOpenFileStream( arcName.c_str(), LVOM_READ );
if ( !stream.isNull() ) {
LVContainerRef arc = LVOpenArchieve(stream);
if ( !arc.isNull() ) {
// convert
for ( int i=0; i<arc->GetObjectCount(); i++ ) {
const LVContainerItemInfo * item = arc->GetObjectInfo(i);
if ( item->IsContainer())
continue;
list.add( item->GetName() );
list.add( lString16::itoa(item->GetSize()) );
}
}
}
return env.toJavaStringArray(list);
}
示例8: GetObjectInfo
//virtual const LVContainerItemInfo * GetObjectInfo(const wchar_t * pname);
virtual const LVContainerItemInfo * GetObjectInfo(int index) { return _container->GetObjectInfo(index); }
示例9: GetBookProperties
int GetBookProperties(char *name, struct BookProperties* pBookProps, int localLanguage)
{
CRLog::trace("GetBookProperties( %s )", name);
memset(pBookProps, 0, sizeof(BookProperties) );
// open stream
LVStreamRef stream = LVOpenFileStream(name, LVOM_READ);
if (!stream) {
CRLog::error("cannot open file %s", name);
return 0;
}
// check archieve
#ifdef USE_ZLIB
LVContainerRef arc;
//printf("start opening arc\n");
//for ( int i=0; i<1000; i++ )
//for ( int kk=0; kk<1000; kk++)
{
arc = LVOpenArchieve( stream );
//printf("end opening arc\n");
if (!arc.isNull())
{
CRLog::trace("%s is archive with %d items", name, arc->GetObjectCount());
// archieve
const LVContainerItemInfo * bestitem = NULL;
const LVContainerItemInfo * fb2item = NULL;
const LVContainerItemInfo * fbditem = NULL;
for (int i=0; i<arc->GetObjectCount(); i++)
{
const LVContainerItemInfo * item = arc->GetObjectInfo(i);
if (item)
{
if ( !item->IsContainer() )
{
lString16 name( item->GetName() );
if ( name.length() > 5 )
{
name.lowercase();
const lChar16 * pext = name.c_str() + name.length() - 4;
if ( pext[0]=='.' && pext[1]=='f' && pext[2]=='b' && pext[3]=='2') {
fb2item = item;
} else if ( pext[0]=='.' && pext[1]=='f' && pext[2]=='b' && pext[3]=='d') {
fbditem = item;
}
}
}
}
}
bestitem = fb2item;
if ( fbditem )
bestitem = fbditem;
if ( !bestitem )
return 0;
CRLog::trace( "opening item %s from archive", UnicodeToUtf8(bestitem->GetName()).c_str() );
//printf("start opening stream\n");
//for ( int k=0; k<1000; k++ ) {
stream = arc->OpenStream( bestitem->GetName(), LVOM_READ );
char buf[8192];
stream->Read(buf, 8192, NULL );
//}
//printf("end opening stream\n");
if ( stream.isNull() )
return 0;
CRLog::trace( "stream created" );
// opened archieve stream
}
}
#endif //USE_ZLIB
// read document
#if COMPACT_DOM==1
ldomDocument doc(stream, 0);
#else
ldomDocument doc;
#endif
ldomDocumentWriter writer(&doc, true);
doc.setNodeTypes( fb2_elem_table );
doc.setAttributeTypes( fb2_attr_table );
doc.setNameSpaceTypes( fb2_ns_table );
LVXMLParser parser( stream, &writer );
CRLog::trace( "checking format..." );
if ( !parser.CheckFormat() ) {
return 0;
}
CRLog::trace( "parsing..." );
if ( !parser.Parse() ) {
return 0;
}
CRLog::trace( "parsed" );
#if 0
char ofname[512];
sprintf(ofname, "%s.xml", name);
CRLog::trace(" writing to file %s", ofname);
LVStreamRef out = LVOpenFileStream(ofname, LVOM_WRITE);
doc.saveToStream(out, "utf16");
#endif
lString16 authors = extractDocAuthors( &doc );
lString16 title = extractDocTitle( &doc );
lString16 series = extractDocSeriesReverse( &doc );
//.........这里部分代码省略.........
示例10: WinMain
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CRLog::setFileLogger( "crengine.log" );
CRLog::setLogLevel( CRLog::LL_TRACE );
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
//make_dither_table();
//TestWol();
/*
LVStreamRef zipfile = LVOpenFileStream( L"zip_test.zip", LVOM_READ );
if (!zipfile.isNull())
{
LVContainerRef zip = LVOpenArchieve( zipfile );
if (!zip.isNull())
{
LVStreamRef log = LVOpenFileStream("ziptest.log", LVOM_WRITE);
for (int i=0; i<zip->GetObjectCount(); i++)
{
const LVContainerItemInfo * item = zip->GetObjectInfo(i);
if (item)
{
//
*log << UnicodeToLocal( item->GetName() );
*log << lString8::itoa( (int)item->GetSize() );
LVStreamRef unpstream = zip->OpenStream( item->GetName(), LVOM_READ );
if (!unpstream.isNull())
{
*log << "\n arc stream opened ok \n";
LVStreamRef outstream = LVOpenFileStream( item->GetName(), LVOM_WRITE );
if ( !outstream.isNull() )
{
int copiedBytes = (int)LVPumpStream( outstream, unpstream );
*log << " copied " << lString8::itoa(copiedBytes) << " bytes\n";
}
else
{
*log << " error opening out stream\n";
}
}
}
}
}
}
*/
lString8 exe_dir;
char exe_fn[MAX_PATH+1];
GetModuleFileNameA( NULL, exe_fn, MAX_PATH );
int last_slash = -1;
int i;
for (i=0; exe_fn[i]; i++)
if (exe_fn[i]=='\\' || exe_fn[i]=='/')
last_slash = i;
if (last_slash>0)
exe_dir = lString8( exe_fn, last_slash );
// init hyphenation manager
initHyph( (exe_dir + "\\russian_EnUS_hyphen_(Alan).pdb").c_str() );
lString8 fontDir = exe_dir;
fontDir << "\\fonts";
// init bitmap font manager
InitFontManager( fontDir );
// Load font definitions into font manager
// fonts are in files font1.lbf, font2.lbf, ... font32.lbf
#if (USE_FREETYPE==1)
LVContainerRef dir = LVOpenDirectory( LocalToUnicode(fontDir).c_str() );
if ( !dir.isNull() )
for ( i=0; i<dir->GetObjectCount(); i++ ) {
const LVContainerItemInfo * item = dir->GetObjectInfo(i);
lString16 fileName = item->GetName();
if ( !item->IsContainer() && fileName.length()>4 && lString16(fileName, fileName.length()-4, 4)==L".ttf" ) {
lString8 fn = UnicodeToLocal(fileName);
printf("loading font: %s\n", fn.c_str());
if ( !fontMan->RegisterFont(fn) ) {
printf(" failed\n");
}
}
}
//fontMan->RegisterFont(lString8("arial.ttf"));
#else
#if (USE_WIN32_FONTS==0)
#define MAX_FONT_FILE 32
for (i=0; i<MAX_FONT_FILE; i++)
{
char fn[32];
sprintf( fn, "font%d.lbf", i );
fontMan->RegisterFont( lString8(fn) );
//.........这里部分代码省略.........