本文整理汇总了C++中Paths::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Paths::end方法的具体用法?C++ Paths::end怎么用?C++ Paths::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paths
的用法示例。
在下文中一共展示了Paths::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
void Instance::Language::Load(wcstring const path)
{
if (!path || !*path)
{
Paths paths;
EnumerateResources( paths );
if (paths.empty())
throw Exception( L"language\\english.nlg file not found!" );
Paths::const_iterator it( paths.begin() );
for (Paths::const_iterator end(paths.end()); it != end; ++it)
{
if (it->File() == L"english.nlg")
break;
}
if (it == paths.end())
it = paths.begin();
if (!resource.Load( it->Ptr() ))
throw Exception( L"Failed to load language plugin file!" );
}
else if (!resource.Load( path ))
{
Load( NULL );
}
}
示例2: XCLIPPER
static VALUE
rbclipper_execute_internal(VALUE self, ClipType cliptype,
VALUE subjfill, VALUE clipfill, VALUE resulttype)
{
if (NIL_P(subjfill)) {
subjfill = ID2SYM(id_even_odd);
}
if (NIL_P(clipfill)) {
clipfill = ID2SYM(id_even_odd);
}
if (NIL_P(resulttype)) {
resulttype = ID2SYM(id_polygons);
}
double inv_multiplier = 1.0 / NUM2LONG(rb_iv_get(self, "@multiplier"));
VALUE r = rb_ary_new();
if (resulttype == ID2SYM(id_polygons)) {
Paths solution;
XCLIPPER(self)->Execute((ClipType) cliptype,
solution,
sym_to_filltype(subjfill),
sym_to_filltype(clipfill));
for(Paths::iterator i = solution.begin(); i != solution.end(); ++i) {
VALUE sub = rb_ary_new();
for(Path::iterator p = i->begin(); p != i->end(); ++p) {
rb_ary_push(sub, rb_ary_new3(2, DBL2NUM(p->X * inv_multiplier), DBL2NUM(p->Y * inv_multiplier)));
}
rb_ary_push(r, sub);
}
}
return r;
}
示例3: XCLIPPEROFFSET
static VALUE
rbclipper_offset_polygons(int argc, VALUE* argv, VALUE self)
{
double multiplier = NUM2DBL(rb_iv_get(self, "@multiplier"));
double inv_multiplier = 1.0 / multiplier;
VALUE polygonsValue, deltaValue, joinTypeValue, endTypeValue;
rb_scan_args(argc, argv, "31", &polygonsValue, &deltaValue, &joinTypeValue, &endTypeValue);
Paths polygons;
for(long i = 0; i != RARRAY_LEN(polygonsValue); i++) {
VALUE sub = rb_ary_entry(polygonsValue, i);
Check_Type(sub, T_ARRAY);
ClipperLib::Path tmp;
ary_to_polygon(sub, &tmp, multiplier);
polygons.push_back(tmp);
}
Paths resultPaths;
XCLIPPEROFFSET(self)->AddPaths(polygons, sym_to_jointype(joinTypeValue), sym_to_endtype(endTypeValue));
XCLIPPEROFFSET(self)->Execute(resultPaths, NUM2DBL(deltaValue) * multiplier);
VALUE r = rb_ary_new();
for(Paths::iterator i = resultPaths.begin(); i != resultPaths.end(); ++i) {
VALUE sub = rb_ary_new();
for(Path::iterator p = i->begin(); p != i->end(); ++p) {
rb_ary_push(sub, rb_ary_new3(2, DBL2NUM(p->X * inv_multiplier), DBL2NUM(p->Y * inv_multiplier)));
}
rb_ary_push(r, sub);
}
return r;
}
示例4: computeNumberOfEdges
/// Compute total number of edges
static size_t computeNumberOfEdges(const Paths& paths)
{
size_t count=0;
for (Paths::const_iterator i = paths.begin(), e = paths.end();
i != e; ++i) {
count += i->size();
}
return count;
}
示例5: _parseCommandLine
void Application::_parseCommandLine()
{
typedef boost::filesystem::path Path;
typedef std::vector<std::string> Paths;
boost::program_options::options_description baseOptions ( "Options" );
baseOptions.add_options()
( "cache-directory", boost::program_options::value<std::string>(), "Specify the cache directory file." );
boost::program_options::options_description hidden ( "Hidden options" );
hidden.add_options()
( "files", boost::program_options::value<Paths>(), "files");
boost::program_options::options_description allOptions;
allOptions.add ( baseOptions ).add ( hidden );
boost::program_options::positional_options_description p;
p.add("files", -1);
// Get the command line arguments.
using Usul::CommandLine::Arguments;
boost::program_options::variables_map vm;
boost::program_options::store (
boost::program_options::command_line_parser ( Arguments::instance().argc(), Arguments::instance().argv() ).
options ( allOptions ).positional(p).allow_unregistered().run(), vm );
// Check for the cache directory.
if ( vm.count ( "cache-directory" ) )
{
const std::string cacheDirectory ( vm["cache-directory"].as<std::string>() );
std::cout << "Setting cache directory to " << cacheDirectory << std::endl;
Minerva::Core::DiskCache::instance().cacheDirectory ( cacheDirectory );
}
Paths filenames;
if ( vm.count ( "files" ) )
{
filenames = vm["files"].as<Paths>();
}
// Have to load the config files now. Remove them from the arguments.
Paths configs;
Path ext ( ".jconf" );
std::remove_copy_if ( filenames.begin(), filenames.end(), std::back_inserter ( configs ),
boost::lambda::bind ( static_cast<Path::string_type (*) ( const Path& )> ( &boost::filesystem::extension ), boost::lambda::_1 ) != ext );
this->_loadConfigFiles ( configs );
// Load the model files.
this->_loadModelFiles ( filenames );
}
示例6: findOverlaps
/** Find every pair of overlapping paths. */
static Overlaps findOverlaps(const Graph& g, const Paths& paths)
{
SeedMap seedMap = makeSeedMap(paths);
Overlaps overlaps;
for (Paths::const_iterator it = paths.begin();
it != paths.end(); ++it) {
unsigned i = it - paths.begin();
findOverlaps(g, paths, seedMap, Vertex(i, false), overlaps);
findOverlaps(g, paths, seedMap, Vertex(i, true), overlaps);
}
return overlaps;
}
示例7: addPathOverlapEdges
/** Add the path overlap edges to the specified graph. */
static void addPathOverlapEdges(Graph& g,
const Paths& paths, const vector<string>& pathIDs,
const Overlaps& overlaps)
{
typedef graph_traits<Graph>::vertex_descriptor V;
const bool allowParallelEdge = opt::mode == opt::ASSEMBLE;
// Add the path vertices.
g_contigNames.unlock();
for (Paths::const_iterator it = paths.begin();
it != paths.end(); ++it) {
const ContigPath& path = *it;
const string& id = pathIDs[it - paths.begin()];
if (!path.empty()) {
V u = merge(g, path.begin(), path.end());
put(vertex_name, g, u, id);
}
}
g_contigNames.lock();
// Remove the single-end contigs that are in paths.
for (Paths::const_iterator it = paths.begin();
it != paths.end(); ++it)
remove_vertex_if(g, it->begin(), it->end(),
not1(std::mem_fun_ref(&ContigNode::ambiguous)));
// Add the path edges.
for (Overlaps::const_iterator it = overlaps.begin();
it != overlaps.end(); ++it) {
V u = it->source.descriptor();
V v = it->target.descriptor();
if (allowParallelEdge || !edge(u, v, g).second)
add_edge(u, v, it->distance, static_cast<DG&>(g));
else if (opt::verbose > 0)
cerr << "ambiguous overlap: " << get(vertex_name, g, u)
<< " -> " << get(vertex_name, g, v) << '\n';
}
}
示例8: visit
void visit(const char* name, const EntityClassScanner& table) const
{
Paths paths;
EntityClassQuake3_constructDirectory(baseDirectory, table.getExtension(), paths);
if(!string_equal(baseDirectory, gameDirectory))
{
EntityClassQuake3_constructDirectory(gameDirectory, table.getExtension(), paths);
}
for(Paths::iterator i = paths.begin(); i != paths.end(); ++i)
{
EntityClassesLoadFile(table, (*i).second)((*i).first.c_str());
}
}
示例9: assembleOverlappingPaths
/** Assemble overlapping paths. */
static void assembleOverlappingPaths(Graph& g,
Paths& paths, vector<string>& pathIDs)
{
if (paths.empty())
return;
// Find overlapping paths.
Overlaps overlaps = findOverlaps(g, paths);
addPathOverlapEdges(g, paths, pathIDs, overlaps);
// Create a property map of path overlaps.
OverlapMap overlapMap;
for (Overlaps::const_iterator it = overlaps.begin();
it != overlaps.end(); ++it)
overlapMap.insert(OverlapMap::value_type(
OverlapMap::key_type(
it->source.descriptor(),
it->target.descriptor()),
it->overlap));
// Assemble unambiguously overlapping paths.
Paths merges;
assemble_if(g, back_inserter(merges),
IsPathOverlap(g, overlapMap, IsPositive<Graph>(g)));
// Merge overlapping paths.
g_contigNames.unlock();
assert(!pathIDs.empty());
setNextContigName(pathIDs.back());
for (Paths::const_iterator it = merges.begin();
it != merges.end(); ++it) {
string name = createContigName();
if (opt::verbose > 0)
cerr << name << '\t' << *it << '\n';
Vertex u(paths.size(), false);
put(vertex_name, g, u.descriptor(), name);
pathIDs.push_back(name);
paths.push_back(mergePaths(paths, overlapMap, *it));
// Remove the merged paths.
for (ContigPath::const_iterator it2 = it->begin();
it2 != it->end(); ++it2) {
if (isPath(*it2))
paths[it2->id() - Vertex::s_offset].clear();
}
}
g_contigNames.lock();
}
示例10: makeSeedMap
/** Index the first and last contig of each path to facilitate finding
* overlaps between paths. */
static SeedMap makeSeedMap(const Paths& paths)
{
SeedMap seedMap;
for (Paths::const_iterator it = paths.begin();
it != paths.end(); ++it) {
if (it->empty())
continue;
assert(!it->front().ambiguous());
seedMap.insert(make_pair(it->front(),
Vertex(it - paths.begin(), false)));
assert(!it->back().ambiguous());
seedMap.insert(make_pair(it->back() ^ 1,
Vertex(it - paths.begin(), true)));
}
return seedMap;
}
示例11: trimOverlaps
/** Find the largest overlap for each contig and remove it. */
static void trimOverlaps(Paths& paths, const Overlaps& overlaps)
{
vector<unsigned> removed[2];
removed[0].resize(paths.size());
removed[1].resize(paths.size());
for (Overlaps::const_iterator it = overlaps.begin();
it != overlaps.end(); ++it) {
unsigned& a = removed[!it->source.sense][it->source.id];
unsigned& b = removed[it->target.sense][it->target.id];
a = max(a, it->overlap);
b = max(b, it->overlap);
}
for (Paths::iterator it = paths.begin(); it != paths.end(); ++it)
removeContigs(*it, removed[0][it - paths.begin()],
it->size() - removed[1][it - paths.begin()]);
}
示例12: calc_poly_centroid
Path Grasp_Calculator::calc_poly_centroid(Paths polygons)
{
std::vector<IntPoint> sums;
for (std::vector<Path>::iterator poly = polygons.begin(); poly != polygons.end(); ++poly)
{
IntPoint sum;
sum.X = 0;
sum.Y = 0;
cInt fuck_u_Cpp = 0;
for (std::vector<IntPoint>::iterator ip = poly->begin(); ip != poly->end(); ++ip, fuck_u_Cpp++)
{
sum.X += ip->X;
sum.Y += ip->Y;
}
sum.X = sum.X / fuck_u_Cpp;
sum.Y = sum.Y / fuck_u_Cpp;
sums.push_back(sum);
}
return sums;
}
示例13: init
void PathManager::init()
{
/// Search for the OGRE plugin folder
ogre_plugin_dir = "";
// Use environment variable, if present
char *plugindir = getenv("OGRE_PLUGIN_DIR");
if (plugindir)
{
ogre_plugin_dir = plugindir;
return;
}
#ifdef _WIN32
// Windows: we assume the ogre plugins are in the directory the program is run from (".")
ogre_plugin_dir = ".";
#else
// Linux: Check a list of common path names
typedef std::vector<boost::filesystem::path> Paths;
Paths dirs;
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(_M_X64)
dirs.push_back("/usr/local/lib64");
dirs.push_back("/usr/lib64");
#else
dirs.push_back("/usr/local/lib32");
dirs.push_back("/usr/lib32");
#endif
dirs.push_back("/usr/local");
dirs.push_back("/usr/lib");
// Loop through the paths and pick the first one that contains a plugin
for (Paths::const_iterator p = dirs.begin(); p != dirs.end(); ++p) {
if (boost::filesystem::exists(*p / "OGRE/RenderSystem_GL.so")) {
ogre_plugin_dir = (*p / "OGRE").string();
break;
} else if (boost::filesystem::exists(*p / "ogre/RenderSystem_GL.so")) {
ogre_plugin_dir = (*p / "ogre").string();
break;
}
}
#endif
}
示例14: Init
void PATHMANAGER::Init(std::ostream & info_output, std::ostream & error_output)
{
typedef std::vector<fs::path> Paths;
// Set Ogre plugins dir
{
ogre_plugin_dir = "";
char *plugindir = getenv("OGRE_PLUGIN_DIR");
if (plugindir) {
ogre_plugin_dir = plugindir;
#ifndef _WIN32
} else if (fs::exists(fs::path(OGRE_PLUGIN_DIR) / "RenderSystem_GL.so")) {
ogre_plugin_dir = OGRE_PLUGIN_DIR;
#endif
} else {
#ifdef _WIN32
ogre_plugin_dir = ".";
#else
Paths dirs;
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(_M_X64)
dirs.push_back("/usr/local/lib64");
dirs.push_back("/usr/lib64");
#else
dirs.push_back("/usr/local/lib32");
dirs.push_back("/usr/lib32");
#endif
dirs.push_back("/usr/local");
dirs.push_back("/usr/lib");
// Loop through the paths and pick the first one that contain a plugin
for (Paths::const_iterator p = dirs.begin(); p != dirs.end(); ++p) {
if (fs::exists(*p / "OGRE/RenderSystem_GL.so")) {
ogre_plugin_dir = (*p / "OGRE").string();
break;
} else if (fs::exists(*p / "ogre/RenderSystem_GL.so")) {
ogre_plugin_dir = (*p / "ogre").string();
break;
}
}
#endif
}
}
fs::path shortDir = "stuntrally";
// Figure out the user's home directory
{
home_dir = "";
#ifndef _WIN32 // POSIX
char *homedir = getenv("HOME");
if (homedir == NULL)
{
home_dir = "/home/";
homedir = getenv("USER");
if (homedir == NULL) {
homedir = getenv("USERNAME");
if (homedir == NULL) {
error_output << "Could not find user's home directory!" << std::endl;
home_dir = "/tmp/";
}
}
}
#else // Windows
char *homedir = getenv("USERPROFILE");
if (homedir == NULL) homedir = "data"; // WIN 9x/Me
#endif
home_dir += homedir;
}
// Find user's config dir
#ifndef _WIN32 // POSIX
{
char const* conf = getenv("XDG_CONFIG_HOME");
if (conf) user_config_dir = (fs::path(conf) / "stuntrally").string();
else user_config_dir = (fs::path(home_dir) / ".config" / "stuntrally").string();
}
#else // Windows
{
// Open AppData directory
std::string str;
ITEMIDLIST* pidl;
char AppDir[MAX_PATH];
HRESULT hRes = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE , &pidl);
if (hRes == NOERROR)
{
SHGetPathFromIDList(pidl, AppDir);
int i;
for (i = 0; AppDir[i] != '\0'; i++) {
if (AppDir[i] == '\\') str += '/';
else str += AppDir[i];
}
user_config_dir = (fs::path(str) / "stuntrally").string();
}
}
#endif
// Create user's config dir
CreateDir(user_config_dir, error_output);
// Find user's data dir (for additional data)
#ifdef _WIN32
user_data_dir = user_config_dir; // APPDATA/stuntrally
#else
//.........这里部分代码省略.........
示例15: PSP
void PSP(Paths&ps) {
PSI psi;
for(psi=ps.begin(); psi!=ps.end(); ++psi) {
PP(*psi);
}
}