本文整理汇总了C++中Paths::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Paths::push_back方法的具体用法?C++ Paths::push_back怎么用?C++ Paths::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paths
的用法示例。
在下文中一共展示了Paths::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getWritePaths
static void getWritePaths(Paths& paths)
{
paths.push_back(PathInfo(SlPaths::GetLobbyWriteDir(), "LobbyWriteDir", true));
paths.push_back(PathInfo(SlPaths::GetCachePath(), "CachePath", true));
paths.push_back(PathInfo(SlPaths::GetExecutableFolder(), "ExecutableFolder", false));
paths.push_back(PathInfo(SlPaths::GetDownloadDir(), "DownloadDir", true));
paths.push_back(PathInfo(SlPaths::GetDataDir(), "Current SpringData:", true));
}
示例2: wxDialog
InfoDialog::InfoDialog(wxWindow* parent)
: wxDialog(parent, wxID_ANY, _("Paths"), wxDefaultPosition, wxSize(620, 400), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxCLOSE_BOX)
{
m_main_sizer = new wxBoxSizer(wxVERTICAL);
typedef std::vector<std::pair<std::string, wxString> > Paths;
Paths paths;
paths.push_back(std::make_pair(SlPaths::GetLobbyWriteDir(), _T("LobbyWriteDir")));
paths.push_back(std::make_pair(SlPaths::GetCachePath(), _T("CachePath")));
paths.push_back(std::make_pair(SlPaths::GetExecutableFolder(), _T("ExecutableFolder")));
paths.push_back(std::make_pair(SlPaths::GetDownloadDir(), _T("DownloadDir")));
paths.push_back(std::make_pair(SlPaths::GetDataDir(), _T("Current SpringData:")));
wxTextCtrl* out = new wxTextCtrl(this, wxNewId(), wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_AUTO_URL);
*out << TowxString(getSpringlobbyAgent()) + _T("\n");
*out << wxString::Format(_T("SpringLobby config file: %s (%s writable)\n"),
TowxString(SlPaths::GetConfigPath()).c_str(),
BtS(wxFileName::IsFileWritable(TowxString(SlPaths::GetConfigPath())), "", "not").c_str());
for (size_t i = 0; i < paths.size(); ++i) {
const wxString path = TowxString(paths[i].first);
*out << wxString::Format(_T("%s (%s)\n"), paths[i].second.c_str(), path.c_str());
const bool wx = wxFileName::IsDirWritable(path);
const bool posix = access(STD_STRING(path).c_str(), WRITABLE) == 0;
bool tried = false;
try {
std::ofstream of;
const wxString dummy_fn = path + wxFileName::GetPathSeparator() + _T("dummy.txt");
of.open(STD_STRING(dummy_fn).c_str());
if (of.is_open()) {
of << "fhreuohgeiuhguie";
of.flush();
of.close();
tried = wxRemoveFile(dummy_fn);
}
} catch (...) {
}
*out << wxString::Format(_T("\tWX: %s POSIX: %s TRY: %s\n"), BtS(wx).c_str(), BtS(posix).c_str(), BtS(tried).c_str());
}
*out << wxString::Format(_T("Current unitsync: %s\n"), TowxString(SlPaths::GetUnitSync()).c_str());
*out << wxString::Format(_T("Current spring executable: %s\n"), TowxString(SlPaths::GetSpringBinary()).c_str());
*out << wxString::Format(_T("Current uikeys.txt: %s\n"), TowxString(SlPaths::GetUikeys()).c_str());
*out << wxString::Format(_T("Portable mode: %s\n"), BtS(SlPaths::IsPortableMode()).c_str());
*out << wxString::Format(_T("Compiled with wxWidgets %d.%d.%d.%d"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, wxSUBRELEASE_NUMBER) + _T("\n");
*out << _T("Started with: \n");
for (int i = 0; i < wxTheApp->argc; ++i)
*out << wxTheApp->argv[i] << _T(" ");
m_main_sizer->Add(out, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0);
SetSizer(m_main_sizer);
Layout();
}
示例3: wxSize
InfoDialog::InfoDialog(wxWindow* parent )
:wxDialog(parent,wxID_ANY, _("path shit"), wxDefaultPosition, wxSize(620,400), wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX)
{
wxBoxSizer* main_sizer = new wxBoxSizer( wxVERTICAL );
typedef std::vector< std::pair< wxString,wxString > >
Paths;
Paths paths;
paths.push_back( std::make_pair( sett().GetLobbyWriteDir(), _T("LobbyWriteDir") ) );
paths.push_back( std::make_pair( sett().GetTempStorage(), _T("TempStorage")) );
paths.push_back( std::make_pair( sett().GetCachePath(), _T("CachePath")) );
paths.push_back( std::make_pair( sett().GetCurrentUsedDataDir(), _T("CurrentUsedDataDir")) );
paths.push_back( std::make_pair( GetExecutableFolder() , _T("ExecutableFolder")));
wxTextCtrl* out = new wxTextCtrl( this, wxNewId(), _T( "" ), wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_AUTO_URL );
for ( size_t i =0; i < paths.size(); ++i )
{
*out << wxString::Format( _T("%s (%s)\n"), paths[i].second.c_str(), paths[i].first.c_str());
wxString path = paths[i].first;
wxString dummy_fn = path + wxFileName::GetPathSeparator() + _T("dummy.txt");
const bool wx = wxFileName::IsDirWritable( path );
const bool posix = access(STD_STRING(path).c_str(), WRITABLE) == 0;
bool tried = false;
try{
std::ofstream of;
of.open( STD_STRING(dummy_fn).c_str() );
if ( of.is_open() )
{
of << "fhreuohgeiuhguie";
of.flush();
of.close();
tried = wxRemoveFile(dummy_fn);
}
}
catch (...){}
*out << wxString::Format( _T("\tWX: %s POSIX: %s TRY: %s\n"), BtS(wx).c_str(), BtS(posix).c_str(), BtS(tried).c_str() );
}
*out << wxString::Format( _T("Global config: %s (%s %s )\n"),
sett().GlobalConfigPath().c_str(),
BtS(wxFileName::FileExists(sett().GlobalConfigPath()), "exists", "missing").c_str(),
BtS(wxFileName::IsFileWritable(sett().GlobalConfigPath()), "writable", "").c_str() );
*out << wxString::Format( _T("Local config: %s (%s writable)\n"),
sett().FinalConfigPath().c_str(),
BtS(wxFileName::IsFileWritable(sett().FinalConfigPath()), "", "not" ).c_str() );
*out << wxString::Format( _T("Portable mode: %s\n"), BtS(sett().IsPortableMode()).c_str() );
*out << _T( "Version " ) + GetSpringLobbyVersion()
<< wxString( wxVERSION_STRING ) + _T(" on ") + wxPlatformInfo::Get().GetOperatingSystemIdName() + _T( "\ncl: " ) ;
for ( int i = 0; i < wxTheApp->argc; ++i )
*out << wxTheApp->argv[i] << _T(" ");
main_sizer->Add( out, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
SetSizer( main_sizer );
Layout();
}
示例4: to_polygons
static bool to_polygons(Paths &polygons, GB_ARRAY array)
{
int count;
CPOLYGON *p;
int i;
if (GB.CheckObject(array))
return true;
count = GB.Array.Count(array);
if (count == 0)
return false;
polygons.clear();
for(i = 0; i < count; i++)
{
p = *(CPOLYGON **)GB.Array.Get(array, i);
if (!p)
continue;
polygons.push_back(*(p->poly));
}
return false;
}
示例5: paths
/** Returns a list of possible paths to the given resource. */
DataManager::Paths DataManager::paths(Path resource) const
{
Paths p;
for (Paths::const_iterator d = dirs.begin(); d != dirs.end(); d++)
p.push_back(*d + resource);
return p;
}
示例6: readPaths
/** Read contig paths from the specified file.
* @param g the contig adjacency graph
* @param inPath the file of contig paths
* @param[out] pathIDs the path IDs
* @return the paths
*/
static Paths readPaths(Graph& g,
const string& inPath, vector<string>& pathIDs)
{
typedef graph_traits<Graph>::vertex_descriptor V;
assert(pathIDs.empty());
ifstream fin(inPath.c_str());
if (opt::verbose > 0)
cerr << "Reading `" << inPath << "'..." << endl;
if (inPath != "-")
assert_good(fin, inPath);
istream& in = inPath == "-" ? cin : fin;
assert_good(in, inPath);
Paths paths;
string id;
ContigPath path;
while (in >> id >> path) {
if (path.empty()) {
// Remove this contig from the graph.
V u = find_vertex(id, false, g);
clear_vertex(u, g);
remove_vertex(u, g);
} else {
pathIDs.push_back(id);
paths.push_back(path);
}
}
assert(in.eof());
return paths;
}
示例7: 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;
}
示例8: NewOutline
int SHAPE_POLY_SET::NewOutline ()
{
Path empty_path;
Paths poly;
poly.push_back(empty_path);
m_polys.push_back(poly);
return m_polys.size() - 1;
}
示例9: getPath
void getPath(string &a, string &b, Tree &tree, Path &path, Paths &ret)
{
if (a == b) { ret.push_back(path); return; }
for (auto &i : tree[a])
{
path.push_back(i);
getPath(i, b, tree, path, ret);
path.pop_back();
}
}
示例10: findLadders
Paths findLadders(string beginWord, string endWord, Dict &wordList)
{
Paths paths;
Path path(1, beginWord);
if (beginWord == endWord) { paths.push_back(path); return paths; }
Dict _front, _back;
_front.insert(beginWord);
_back.insert(endWord);
Tree tree;
if (build(_front, _back, wordList, tree, false))
getPath(beginWord, endWord, tree, path, paths);
return paths;
}
示例11: it
static void find_mp3_files(const Path& dir_path, Paths& paths) {
if (!exists(dir_path)) {
return;
}
boost::filesystem::directory_iterator it(dir_path);
const boost::filesystem::directory_iterator end_it;
for (; it != end_it; ++it) {
if (is_directory(it->status())) {
find_mp3_files(it->path(), paths);
} else if (boost::ends_with(it->path().string(), ".mp3")) {
paths.push_back(it->path());
}
}
}
示例12: XCLIPPER
static VALUE
rbclipper_add_polygons_internal(VALUE self, VALUE polygonsValue, PolyType polytype) {
double multiplier = NUM2DBL(rb_iv_get(self, "@multiplier"));
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);
}
XCLIPPER(self)->AddPaths(polygons, polytype, true);
return Qnil;
}
示例13: 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();
}
示例14: AddOutline
int SHAPE_POLY_SET::AddOutline( const SHAPE_LINE_CHAIN& aOutline )
{
assert ( aOutline.IsClosed() );
Path p = convert ( aOutline );
Paths poly;
if( !Orientation( p ) )
ReversePath(p); // outlines are always CW
poly.push_back( p );
m_polys.push_back( poly );
return m_polys.size() - 1;
}
示例15: path
void Instance::Language::EnumerateResources(Paths& paths) const
{
for (uint i=0; i < 2 && paths.empty(); ++i)
{
struct FileFinder
{
WIN32_FIND_DATA data;
HANDLE const handle;
FileFinder(wcstring const path)
: handle(::FindFirstFile( path, &data )) {}
~FileFinder()
{
if (handle != INVALID_HANDLE_VALUE)
::FindClose( handle );
}
};
Path path( Instance::GetExePath(i ? L"*.*" : L"language\\*.*") );
FileFinder findFile( path.Ptr() );
if (findFile.handle != INVALID_HANDLE_VALUE)
{
do
{
if (!(findFile.data.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_DIRECTORY)))
{
path.File() = findFile.data.cFileName;
if (path.Extension() == L"nlg")
paths.push_back( path );
}
}
while (::FindNextFile( findFile.handle, &findFile.data ));
}
}
}