本文整理汇总了C++中GList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ GList::append方法的具体用法?C++ GList::append怎么用?C++ GList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GList
的用法示例。
在下文中一共展示了GList::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mpath
GList<GURL>
DjVuMessage::GetProfilePaths(void)
{
static bool first=true;
static GList<GURL> realpaths;
if(first)
{
first=false;
GMap<GUTF8String,void *> pathsmap;
GList<GURL> paths;
GURL path;
const GUTF8String envp(GOS::getenv(DjVuEnv));
if(envp.length())
appendPath(GURL::Filename::UTF8(envp),pathsmap,paths);
#if defined(WIN32) || defined(UNIX)
GURL mpath(GetModulePath());
if(!mpath.is_empty() && mpath.is_dir())
{
#if defined(UNIX) && !defined(AUTOCONF) && !defined(NDEBUG)
appendPath(GURL::UTF8(DebugModuleDjVuDir,mpath),pathsmap,paths);
#endif
appendPath(mpath,pathsmap,paths);
appendPath(GURL::UTF8(ModuleDjVuDir,mpath),pathsmap,paths);
appendPath(GURL::UTF8(ProfilesDjVuDir,mpath),pathsmap,paths);
mpath=mpath.base();
appendPath(GURL::UTF8(ModuleDjVuDir,mpath),pathsmap,paths);
appendPath(GURL::UTF8(ProfilesDjVuDir,mpath),pathsmap,paths);
mpath=mpath.base();
appendPath(GURL::UTF8(ModuleDjVuDir,mpath),pathsmap,paths);
appendPath(GURL::UTF8(ProfilesDjVuDir,mpath),pathsmap,paths);
mpath=mpath.base();
appendPath(GURL::UTF8(ModuleDjVuDir,mpath),pathsmap,paths);
appendPath(GURL::UTF8(ProfilesDjVuDir,mpath),pathsmap,paths);
}
#endif
#if defined(AUTOCONF)
GURL dpath = GURL::Filename::UTF8(DjVuDataDir);
appendPath(dpath,pathsmap,paths);
#endif
#ifdef WIN32
appendPath(RegOpenReadConfig(HKEY_CURRENT_USER),pathsmap,paths);
appendPath(RegOpenReadConfig(HKEY_LOCAL_MACHINE),pathsmap,paths);
#else
GUTF8String home=GOS::getenv("HOME");
# if HAVE_GETPWUID
if (! home.length()) {
struct passwd *pw=0;
if ((pw = getpwuid(getuid())))
home=GNativeString(pw->pw_dir);
}
# endif
if (home.length()) {
GURL hpath = GURL::UTF8(LocalDjVuDir,GURL::Filename::UTF8(home));
appendPath(hpath,pathsmap,paths);
}
#endif
#ifdef LT_DEFAULT_PREFIX
appendPath(GURL::Filename::UTF8(DjVuPrefixDir),pathsmap,paths);
#endif
appendPath(GURL::Filename::UTF8(RootDjVuDir),pathsmap,paths);
pathsmap.empty();
GPosition pos;
GList< GMap<GUTF8String,GP<lt_XMLTags> > > localemaps;
for(pos=paths;pos;++pos)
{
path=GURL::UTF8(LanguageFile,paths[pos]);
if(path.is_file())
{
const GP<lt_XMLTags> xml(lt_XMLTags::create(ByteStream::create(path,"rb")));
const GPList<lt_XMLTags> Body(xml->get_Tags(bodystring));
GPosition pos=Body;
if(!pos || (pos != Body.lastpos()))
{
G_THROW( ERR_MSG("XMLAnno.extra_body") );
}
const GP<lt_XMLTags> GBody(Body[pos]);
if(!GBody)
{
G_THROW( ERR_MSG("XMLAnno.no_body") );
}
GMap<GUTF8String,GP<lt_XMLTags> > localemap;
lt_XMLTags::get_Maps(languagestring,localestring,Body,localemap);
localemaps.append(localemap);
}
}
GList<GURL> localepaths;
// Need to do it the right way!
GUTF8String defaultlocale = getenv("LANGUAGE");
if (! defaultlocale)
{
const GUTF8String oldlocale(setlocale(LC_MESSAGES,0));
defaultlocale = setlocale(LC_MESSAGES,"");
setlocale(LC_MESSAGES,(const char *)oldlocale);
}
// Unfathomable search.
for(int loop=0; loop<2; loop++)
{
static const char sepchars[]=" [email protected]";
//.........这里部分代码省略.........
示例2: mesg
static GUTF8String
getbodies(
GList<GURL> &paths,
const GUTF8String &MessageFileName,
GPList<lt_XMLTags> &body,
GMap<GUTF8String, void *> & map )
{
GUTF8String errors;
bool isdone=false;
GPosition firstpathpos=paths;
for(GPosition pathpos=firstpathpos;!isdone && pathpos;++pathpos)
{
const GURL::UTF8 url(MessageFileName,paths[pathpos]);
if(url.is_file())
{
map[MessageFileName]=0;
GP<lt_XMLTags> gtags;
{
GP<ByteStream> bs=ByteStream::create(url,"rb");
G_TRY
{
gtags=lt_XMLTags::create(bs);
}
G_CATCH(ex)
{
GUTF8String mesg(failed_to_parse_XML+("\t"+url.get_string()));
if(errors.length())
{
errors+="\n"+mesg;
}else
{
errors=mesg;
}
errors+="\n"+GUTF8String(ex.get_cause());
}
G_ENDCATCH;
}
if(gtags)
{
lt_XMLTags &tags=*gtags;
GPList<lt_XMLTags> Bodies=tags.get_Tags(bodystring);
if(! Bodies.isempty())
{
isdone=true;
for(GPosition pos=Bodies;pos;++pos)
{
body.append(Bodies[pos]);
}
}
GPList<lt_XMLTags> Head=tags.get_Tags(headstring);
if(! Head.isempty())
{
isdone=true;
GMap<GUTF8String, GP<lt_XMLTags> > includes;
lt_XMLTags::get_Maps(includestring,namestring,Head,includes);
for(GPosition pos=includes;pos;++pos)
{
const GUTF8String file=includes.key(pos);
if(! map.contains(file))
{
GList<GURL> xpaths;
xpaths.append(url.base());
const GUTF8String err2(getbodies(xpaths,file,body,map));
if(err2.length())
{
if(errors.length())
{
errors+="\n"+err2;
}else
{
errors=err2;
}
}
}
}
}
}
}
}
示例3: if
GList<DjVuTXT::Zone *>
DjVuTXT::find_text_in_rect(GRect target_rect, GUTF8String &text) const
// returns a list of zones of type WORD in the nearest/selected paragraph
{
GList<Zone *> zone_list;
GList<Zone *> lines;
get_zones((int)PARAGRAPH, &page_zone, zone_list);
// it's possible that no paragraph structure exists for reasons that
// 1) ocr engine is not capable 2) file was modified by user. In such case,
// we can only make a rough guess, i.e., select all the lines intersected with
// target_rect
if (zone_list.isempty())
{
get_zones((int)LINE, &page_zone, zone_list);
GPosition pos;
for(pos=zone_list; pos; ++pos)
{
GRect rect=zone_list[pos]->rect;
int h0=rect.height()/2;
if(rect.intersect(rect,target_rect) && rect.height()>h0)
lines.append(zone_list[pos]);
}
} else
{
GPosition pos, pos_sel=zone_list;
float ar=0;
for(pos=zone_list; pos; ++pos)
{
GRect rect=zone_list[pos]->rect;
int area=rect.area();
if (rect.intersect(rect, target_rect))
{
float ftmp=rect.area()/(float)area;
if ( !ar || ar<ftmp )
{
ar=ftmp;
pos_sel=pos;
}
}
}
Zone *parag = 0;
if ( ar>0 ) parag=zone_list[pos_sel];
zone_list.empty();
if ( ar>0 )
{
get_zones((int)LINE, parag, zone_list);
if ( !zone_list.isempty() )
{
for(GPosition pos=zone_list; pos; ++pos)
{
GRect rect=zone_list[pos]->rect;
int h0=rect.height()/2;
if(rect.intersect(rect,target_rect) && rect.height()>h0)
lines.append(zone_list[pos]);
}
}
}
}
zone_list.empty();
if (!lines.isempty())
{
int i=1, lsize=lines.size();
GList<Zone *> words;
for (GPosition pos=lines; pos; ++pos, ++i)
{
words.empty();
get_zones((int)WORD, lines[pos], words);
if ( lsize==1 )
{
for(GPosition p=words;p;++p)
{
GRect rect=words[p]->rect;
if(rect.intersect(rect,target_rect))
//if (target_rect.contains(words[p]->rect))
zone_list.append(words[p]);
}
} else
{
if (i==1)
{
bool start=true;
for(GPosition p=words; p; ++p)
{
if ( start )
{
GRect rect=words[p]->rect;
if(rect.intersect(rect,target_rect))
//if (target_rect.contains(words[p]->rect))
{
start=false;
zone_list.append(words[p]);
}
} else
zone_list.append(words[p]);
}
} else if (i==lsize)
//.........这里部分代码省略.........