本文整理汇总了C++中path函数的典型用法代码示例。如果您正苦于以下问题:C++ path函数的具体用法?C++ path怎么用?C++ path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: append
template <class InputIterator>
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
// ----- modifiers -----
void clear() BOOST_NOEXCEPT { m_pathname.clear(); }
path& make_preferred()
# ifdef BOOST_POSIX_API
{ return *this; } // POSIX no effect
# else // BOOST_WINDOWS_API
; // change slashes to backslashes
# endif
path& remove_filename();
path& remove_trailing_separator();
path& replace_extension(const path& new_extension = path());
void swap(path& rhs) BOOST_NOEXCEPT { m_pathname.swap(rhs.m_pathname); }
// ----- observers -----
// For operating systems that format file paths differently than directory
// paths, return values from observers are formatted as file names unless there
// is a trailing separator, in which case returns are formatted as directory
// paths. POSIX and Windows make no such distinction.
// Implementations are permitted to return const values or const references.
// The string or path returned by an observer are specified as being formatted
// as "native" or "generic".
//
// For POSIX, these are all the same format; slashes and backslashes are as input and
开发者ID:bredelings,项目名称:BAli-Phy,代码行数:30,代码来源:path.hpp
示例2: path
void
PathBox::SetPath(const entry_ref &ref)
{
BPath path(&ref);
fPathControl->SetText(path.Path());
}
开发者ID:passick,项目名称:Paladin,代码行数:6,代码来源:PathBox.cpp
示例3: machine
void ui_menu_crosshair::populate()
{
crosshair_user_settings settings;
crosshair_item_data *data;
char temp_text[16];
int player;
UINT8 use_auto = false;
UINT32 flags = 0;
/* loop over player and add the manual items */
for (player = 0; player < MAX_PLAYERS; player++)
{
/* get the user settings */
machine().crosshair().get_user_settings(player, &settings);
/* add menu items for usable crosshairs */
if (settings.used)
{
/* Make sure to keep these matched to the CROSSHAIR_VISIBILITY_xxx types */
static const char *const vis_text[] = { "Off", "On", "Auto" };
/* track if we need the auto time menu */
if (settings.mode == CROSSHAIR_VISIBILITY_AUTO) use_auto = true;
/* CROSSHAIR_ITEM_VIS - allocate a data item and fill it */
data = (crosshair_item_data *)m_pool_alloc(sizeof(*data));
data->type = CROSSHAIR_ITEM_VIS;
data->player = player;
data->min = CROSSHAIR_VISIBILITY_OFF;
data->max = CROSSHAIR_VISIBILITY_AUTO;
data->defvalue = CROSSHAIR_VISIBILITY_DEFAULT;
data->cur = settings.mode;
/* put on arrows */
if (data->cur > data->min)
flags |= MENU_FLAG_LEFT_ARROW;
if (data->cur < data->max)
flags |= MENU_FLAG_RIGHT_ARROW;
/* add CROSSHAIR_ITEM_VIS menu */
sprintf(temp_text, "P%d Visibility", player + 1);
item_append(temp_text, vis_text[settings.mode], flags, data);
/* CROSSHAIR_ITEM_PIC - allocate a data item and fill it */
data = (crosshair_item_data *)m_pool_alloc(sizeof(*data));
data->type = CROSSHAIR_ITEM_PIC;
data->player = player;
data->last_name[0] = 0;
/* other data item not used by this menu */
/* search for crosshair graphics */
/* open a path to the crosshairs */
file_enumerator path(machine().options().crosshair_path());
const osd_directory_entry *dir;
/* reset search flags */
int using_default = false;
int finished = false;
int found = false;
/* if we are using the default, then we just need to find the first in the list */
if (*(settings.name) == 0)
using_default = true;
/* look for the current name, then remember the name before */
/* and find the next name */
while (((dir = path.next()) != nullptr) && !finished)
{
int length = strlen(dir->name);
/* look for files ending in .png with a name not larger then 9 chars*/
if ((length > 4) && (length <= CROSSHAIR_PIC_NAME_LENGTH + 4) &&
dir->name[length - 4] == '.' &&
tolower((UINT8)dir->name[length - 3]) == 'p' &&
tolower((UINT8)dir->name[length - 2]) == 'n' &&
tolower((UINT8)dir->name[length - 1]) == 'g')
{
/* remove .png from length */
length -= 4;
if (found || using_default)
{
/* get the next name */
strncpy(data->next_name, dir->name, length);
data->next_name[length] = 0;
finished = true;
}
else if (!strncmp(dir->name, settings.name, length))
{
/* we found the current name */
/* so loop once more to find the next name */
found = true;
}
else
/* remember last name */
/* we will do it here in case files get added to the directory */
{
strncpy(data->last_name, dir->name, length);
data->last_name[length] = 0;
//.........这里部分代码省略.........
开发者ID:notaz,项目名称:mame,代码行数:101,代码来源:miscmenu.cpp
示例4: JSON_Fix
/// Basic and really simplistic routine to fix malformatted .json files
/// It will replace the old version of your file on success and create a backup of the old one (called <filename>_backup.json)
/// Currently it fixes: double commata, missing " for non-numeric strings
int JSON_Fix(const char *filename)
{
string s;
copystring(s, filename);
const char *found = findfile(path(s), "");
char *buf = loadfile(found, NULL);
if(!buf) return -1;
JSON_Minify(buf);
size_t len = strlen(buf);
char *newbuf = new char[len + 1];
size_t pos = 0; //current position in the newbuf
for(size_t i = 0; i < len; i++)
{
if(buf[i] == ',')
{
if(!i) i++; //buf starts with a commata
else if(buf[i + 1] == ',') i++; //two subsequent commata
else
{
newbuf[pos] = buf[i];
pos++;
}
}
else if(isalpha(buf[i]))
{
if(!i) //todo worst case: is it an array or object?
return 0;
else if(buf[i - 1] != '\"') {
newbuf[pos] = '\"'; pos++;
} //string was missing a leading "
newbuf[pos] = buf[i];
pos++;
}
else
{
if(i && isalpha(i - 1)) {
newbuf[pos] = '\"'; pos++;
} //string was missing a trailing "
newbuf[pos] = buf[i];
pos++;
}
}
JSON *j = JSON_Parse(newbuf);
if(j)
{
conoutf("%s was malformatted but has been fixed automatically. \nThe original file has been overwritten, but backuped", found);
//cutextension .. getextension
defformatstring(backupname)("%s_backup", found);
if(!rename(found, backupname)) j->save(found);
delete j;
delete[] buf;
delete[] newbuf;
return 1;
}
delete[] buf;
delete[] newbuf;
return 0;
}
开发者ID:Boom-Rang,项目名称:inexor-code,代码行数:66,代码来源:json.cpp
示例5: path
QgsDataItem *QgsOgrDataItemProvider::createDataItem( const QString &pathIn, QgsDataItem *parentItem )
{
QString path( pathIn );
if ( path.isEmpty() )
return nullptr;
QgsDebugMsgLevel( "thePath: " + path, 2 );
// zip settings + info
QgsSettings settings;
QString scanZipSetting = settings.value( QStringLiteral( "qgis/scanZipInBrowser2" ), "basic" ).toString();
QString vsiPrefix = QgsZipItem::vsiPrefix( path );
bool is_vsizip = ( vsiPrefix == QLatin1String( "/vsizip/" ) );
bool is_vsigzip = ( vsiPrefix == QLatin1String( "/vsigzip/" ) );
bool is_vsitar = ( vsiPrefix == QLatin1String( "/vsitar/" ) );
// should we check ext. only?
// check if scanItemsInBrowser2 == extension or parent dir in scanItemsFastScanUris
// TODO - do this in dir item, but this requires a way to inform which extensions are supported by provider
// maybe a callback function or in the provider registry?
bool scanExtSetting = false;
if ( ( settings.value( QStringLiteral( "qgis/scanItemsInBrowser2" ),
"extension" ).toString() == QLatin1String( "extension" ) ) ||
( parentItem && settings.value( QStringLiteral( "qgis/scanItemsFastScanUris" ),
QStringList() ).toStringList().contains( parentItem->path() ) ) ||
( ( is_vsizip || is_vsitar ) && parentItem && parentItem->parent() &&
settings.value( QStringLiteral( "qgis/scanItemsFastScanUris" ),
QStringList() ).toStringList().contains( parentItem->parent()->path() ) ) )
{
scanExtSetting = true;
}
// get suffix, removing .gz if present
QString tmpPath = path; //path used for testing, not for layer creation
if ( is_vsigzip )
tmpPath.chop( 3 );
QFileInfo info( tmpPath );
QString suffix = info.suffix().toLower();
// extract basename with extension
info.setFile( path );
QString name = info.fileName();
// If a .tab exists, then the corresponding .map/.dat is very likely a
// side-car file of the .tab
if ( suffix == QLatin1String( "map" ) || suffix == QLatin1String( "dat" ) )
{
if ( QFileInfo( QDir( info.path() ), info.baseName() + ".tab" ).exists() )
return nullptr;
}
QgsDebugMsgLevel( "thePath= " + path + " tmpPath= " + tmpPath + " name= " + name
+ " suffix= " + suffix + " vsiPrefix= " + vsiPrefix, 3 );
QStringList myExtensions = fileExtensions();
QStringList dirExtensions = directoryExtensions();
// allow only normal files, supported directories, or VSIFILE items to continue
bool isOgrSupportedDirectory = info.isDir() && dirExtensions.contains( suffix );
if ( !isOgrSupportedDirectory && !info.isFile() && vsiPrefix.isEmpty() )
return nullptr;
// skip *.aux.xml files (GDAL auxiliary metadata files),
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
// unless that extension is in the list (*.xml might be though)
if ( path.endsWith( QLatin1String( ".aux.xml" ), Qt::CaseInsensitive ) &&
!myExtensions.contains( QStringLiteral( "aux.xml" ) ) )
return nullptr;
if ( path.endsWith( QLatin1String( ".shp.xml" ), Qt::CaseInsensitive ) &&
!myExtensions.contains( QStringLiteral( "shp.xml" ) ) )
return nullptr;
if ( path.endsWith( QLatin1String( ".tif.xml" ), Qt::CaseInsensitive ) &&
!myExtensions.contains( QStringLiteral( "tif.xml" ) ) )
return nullptr;
// skip QGIS style xml files
if ( path.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) &&
QgsStyle::isXmlStyleFile( path ) )
return nullptr;
// We have to filter by extensions, otherwise e.g. all Shapefile files are displayed
// because OGR drive can open also .dbf, .shx.
if ( myExtensions.indexOf( suffix ) < 0 && !dirExtensions.contains( suffix ) )
{
bool matches = false;
const auto constWildcards = wildcards();
for ( const QString &wildcard : constWildcards )
{
QRegExp rx( wildcard, Qt::CaseInsensitive, QRegExp::Wildcard );
if ( rx.exactMatch( info.fileName() ) )
{
matches = true;
break;
}
}
if ( !matches )
return nullptr;
}
// .dbf should probably appear if .shp is not present
if ( suffix == QLatin1String( "dbf" ) )
//.........这里部分代码省略.........
开发者ID:dmarteau,项目名称:QGIS,代码行数:101,代码来源:qgsogrdataitems.cpp
示例6: on_draw
virtual void on_draw()
{
pixfmt pixf(rbuf_window());
renderer_base rb(pixf);
renderer_solid r(rb);
rb.clear(agg::rgba(1, 1, 1));
scanline_type sl;
agg::rasterizer_scanline_aa<> ras;
m_poly.close(m_close.status());
agg::simple_polygon_vertex_source path(m_poly.polygon(),
m_poly.num_points(),
false,
m_close.status());
typedef agg::conv_bspline<agg::simple_polygon_vertex_source> conv_bspline_type;
conv_bspline_type bspline(path);
bspline.interpolation_step(1.0 / m_num_points.value());
agg::trans_single_path tcurve;
tcurve.add_path(bspline);
tcurve.preserve_x_scale(m_preserve_x_scale.status());
if(m_fixed_len.status()) tcurve.base_length(1120);
typedef agg::conv_curve<font_manager_type::path_adaptor_type> conv_font_curve_type;
typedef agg::conv_segmentator<conv_font_curve_type> conv_font_segm_type;
typedef agg::conv_transform<conv_font_segm_type, agg::trans_single_path> conv_font_trans_type;
conv_font_curve_type fcurves(m_fman.path_adaptor());
conv_font_segm_type fsegm(fcurves);
conv_font_trans_type ftrans(fsegm, tcurve);
fsegm.approximation_scale(3.0);
fcurves.approximation_scale(2.0);
if(m_feng.load_font(full_file_name("timesi.ttf"), 0, agg::glyph_ren_outline))
{
double x = 0.0;
double y = 3.0;
const char* p = text;
m_feng.hinting(false);
m_feng.height(40);
while(*p)
{
const agg::glyph_cache* glyph = m_fman.glyph(*p);
if(glyph)
{
if(x > tcurve.total_length()) break;
m_fman.add_kerning(&x, &y);
m_fman.init_embedded_adaptors(glyph, x, y);
if(glyph->data_type == agg::glyph_data_outline)
{
ras.reset();
ras.add_path(ftrans);
r.color(agg::srgba8(0, 0, 0));
agg::render_scanlines(ras, sl, r);
}
// increment pen position
x += glyph->advance_x;
y += glyph->advance_y;
}
++p;
}
}
else
{
message("Please copy file timesi.ttf to the current directory\n"
"or download it from http://www.antigrain.com/timesi.zip");
}
typedef agg::conv_stroke<conv_bspline_type> conv_stroke_type;
conv_stroke_type stroke(bspline);
stroke.width(2.0);
r.color(agg::srgba8(170, 50, 20, 100));
ras.add_path(stroke);
agg::render_scanlines(ras, sl, r);
//--------------------------
// Render the "poly" tool and controls
r.color(agg::rgba(0, 0.3, 0.5, 0.3));
ras.add_path(m_poly);
agg::render_scanlines(ras, sl, r);
agg::render_ctrl(ras, sl, rb, m_close);
agg::render_ctrl(ras, sl, rb, m_preserve_x_scale);
agg::render_ctrl(ras, sl, rb, m_fixed_len);
agg::render_ctrl(ras, sl, rb, m_animate);
agg::render_ctrl(ras, sl, rb, m_num_points);
//--------------------------
}
开发者ID:Bashakov,项目名称:agg,代码行数:100,代码来源:trans_curve1_ft.cpp
示例7: main
//.........这里部分代码省略.........
finalize(1);
}
// Establish input filename:
ossimFilename inputFile;
ossimKeywordlist kwl;
if (spec_kwl_file.isReadable())
{
kwl.addFile(spec_kwl_file);
inputFile = kwl.find(ossimKeywordNames::IMAGE_FILE_KW);
outputFile = kwl.find(ossimKeywordNames::OUTPUT_FILE_KW);
}
else
{
inputFile = argv[1];
}
// Establish the input image handler:
ossimRefPtr<ossimImageHandler> handler = ossimImageHandlerRegistry::instance()->open(inputFile);
if (!handler.valid())
{
ossimNotify(ossimNotifyLevel_FATAL)<<argumentParser.getApplicationName().c_str()
<<" Error encountered opening input file <"<<inputFile<<">."<<endl;
finalize(1);
}
// Establish output filename:
if (outputFile.empty())
outputFile = handler->getFilenameWithThisExtension("mask", entry_specified);
if (!outputDir.empty())
outputFile.setPath(outputDir);
else
{
ossimFilename path (outputFile.path());
if (path.empty())
outputFile.setPath(inputFile.path());
}
// Consider input file with multiple entries:
std::vector<ossim_uint32> entryList;
handler->getEntryList(entryList);
if (entryList.size() <= entry)
{
ossimNotify(ossimNotifyLevel_FATAL)<<argumentParser.getApplicationName().c_str()
<<" Entry specified <"<<entry<<"> exceeds total number of entries available <"
<<entryList.size()<<">. Aborting..."<<endl;
finalize(1);
}
handler->setCurrentEntry(entry);
// Establish a keywordlist to pass to the mask builder. This KWL may have already been specified
// on the command line with --spec_kwl option:
kwl.add(ossimKeywordNames::OUTPUT_FILE_KW, outputFile.chars()); // may overwrite same value
if (kwl.getSize() == 0)
{
kwl.add(ossimKeywordNames::IMAGE_FILE_KW, inputFile.chars());
ossimString target_str (ossimString::toString(target_min)+" "+ossimString::toString(target_max));
kwl.add(ossimPixelFlipper::PF_TARGET_RANGE_KW, target_str.chars());
kwl.add(ossimPixelFlipper::PF_REPLACEMENT_MODE_KW, mask_mode.chars());
kwl.add(ossimPixelFlipper::PF_REPLACEMENT_VALUE_KW, (int) 0);
if (exclude_r0)
kwl.add(ossimBitMaskWriter::BM_STARTING_RLEVEL_KW, (int) 1);
else
kwl.add(ossimBitMaskWriter::BM_STARTING_RLEVEL_KW, (int) 0);
}
开发者ID:BJangeofan,项目名称:ossim,代码行数:67,代码来源:ossim-create-bitmask.cpp
示例8: MergeRootfile
void MergeRootfile( TDirectory *target, TList *sourcelist) {
// cout << "Target path: " << target->GetPath() << endl;
TString path( (char*)strstr( target->GetPath(), ":" ) );
path.Remove( 0, 2 );
TFile *first_source = (TFile*)sourcelist->First();
first_source->cd( path );
TDirectory *current_sourcedir = gDirectory;
//gain time, do not add the objects in the list in memory
Bool_t status = TH1::AddDirectoryStatus();
TH1::AddDirectory(kFALSE);
// loop over all keys in this directory
TChain *globChain = 0;
TIter nextkey( current_sourcedir->GetListOfKeys() );
TKey *key, *oldkey=0;
std::vector<double>::iterator wItr;
while ( (key = (TKey*)nextkey())) {
wItr=WeightList->begin();
//keep only the highest cycle number for each key
if (oldkey && !strcmp(oldkey->GetName(),key->GetName())) continue;
// read object from first source file
first_source->cd( path );
TObject *obj = key->ReadObj();
if ( obj->IsA()->InheritsFrom( "TH1" ) ) {
// descendant of TH1 -> merge it
// cout << "Merging histogram " << obj->GetName() << endl;
TH1 *h1 = (TH1*)obj;
h1->Sumw2();
// weight is eff * sigma, because the histos are produced on the ~same initial
// events, and eff is already included (in reconstruction), weight is just sigma
h1->Scale(double(*wItr));
// loop over all source files and add the content of the
// correspondant histogram to the one pointed to by "h1"
TFile *nextsource = (TFile*)sourcelist->After( first_source );
wItr++;
while ( nextsource ) {
// make sure we are at the correct directory level by cd'ing to path
nextsource->cd( path );
TKey *key2 = (TKey*)gDirectory->GetListOfKeys()->FindObject(h1->GetName());
if (key2) {
TH1 *h2 = (TH1*)key2->ReadObj();
h2->Sumw2();
h2->Scale( double(*wItr) );
h1->Add( h2 );
delete h2;
}
nextsource = (TFile*)sourcelist->After( nextsource );
wItr++;
}
}
else if ( obj->IsA()->InheritsFrom( "TTree" ) ) {
// loop over all source files create a chain of Trees "globChain"
const char* obj_name= obj->GetName();
globChain = new TChain(obj_name);
globChain->Add(first_source->GetName());
TFile *nextsource = (TFile*)sourcelist->After( first_source );
// const char* file_name = nextsource->GetName();
// cout << "file name " << file_name << endl;
while ( nextsource ) {
globChain->Add(nextsource->GetName());
nextsource = (TFile*)sourcelist->After( nextsource );
}
} else if ( obj->IsA()->InheritsFrom( "TDirectory" ) ) {
// it's a subdirectory
cout << "Found subdirectory " << obj->GetName() << endl;
// create a new subdir of same name and title in the target file
target->cd();
TDirectory *newdir = target->mkdir( obj->GetName(), obj->GetTitle() );
// newdir is now the starting point of another round of merging
// newdir still knows its depth within the target file via
// GetPath(), so we can still figure out where we are in the recursion
MergeRootfile( newdir, sourcelist );
} else {
// object is of no type that we know or can handle
cout << "Unknown object type, name: "
<< obj->GetName() << " title: " << obj->GetTitle() << endl;
}
// now write the merged histogram (which is "in" obj) to the target file
//.........这里部分代码省略.........
开发者ID:VecbosApp,项目名称:HiggsAnalysisTools,代码行数:101,代码来源:hadd.C
示例9: qMax
void EraserTool::drawStroke()
{
StrokeTool::drawStroke();
QList<QPointF> p = m_pStrokeManager->interpolateStroke(currentWidth);
Layer *layer = m_pEditor->getCurrentLayer();
if (layer->type == Layer::BITMAP)
{
for (int i = 0; i < p.size(); i++) {
p[i] = m_pScribbleArea->pixelToPoint(p[i]);
}
qreal opacity = 1.0;
qreal brushWidth = currentWidth + 0.5 * properties.feather;
qreal offset = qMax(0.0, currentWidth - 0.5 * properties.feather) / brushWidth;
opacity = currentPressure;
brushWidth = brushWidth * currentPressure;
// if (tabletInUse) { opacity = tabletPressure; }
// if (usePressure) { brushWidth = brushWidth * tabletPressure; }
qreal brushStep = 0.5 * currentWidth + 0.5 * properties.feather;
brushStep = brushStep * currentPressure;
// if (usePressure) { brushStep = brushStep * tabletPressure; }
brushStep = qMax(1.0, brushStep);
currentWidth = properties.width;
BlitRect rect;
QRadialGradient radialGrad(QPointF(0,0), 0.5 * brushWidth);
m_pScribbleArea->setGaussianGradient(radialGrad, QColor(255,255,255), opacity, offset);
QPointF a = lastBrushPoint;
QPointF b = getCurrentPoint();
// foreach (QSegment segment, calculateStroke(brushWidth))
// {
// QPointF a = lastBrushPoint;
// QPointF b = m_pScribbleArea->pixelToPoint(segment.second);
qreal distance = 4 * QLineF(b, a).length();
int steps = qRound(distance) / brushStep;
for (int i = 0; i < steps; i++)
{
QPointF point = lastBrushPoint + (i + 1) * (brushStep) * (b - lastBrushPoint) / distance;
rect.extend(point.toPoint());
m_pScribbleArea->drawBrush(point, brushWidth, offset, QColor(255,255,255), opacity);
if (i == (steps - 1))
{
lastBrushPoint = point;
}
}
// }
int rad = qRound(brushWidth) / 2 + 2;
m_pScribbleArea->refreshBitmap(rect, rad);
}
else if (layer->type == Layer::VECTOR)
{
QPen pen(Qt::white, currentWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
int rad = qRound((currentWidth / 2 + 2) * (qAbs(m_pScribbleArea->getTempViewScaleX()) + qAbs(m_pScribbleArea->getTempViewScaleY())));
if (p.size() == 4) {
QSizeF size(2,2);
QPainterPath path(p[0]);
path.cubicTo(p[1],
p[2],
p[3]);
m_pScribbleArea->drawPath(path, pen, Qt::NoBrush, QPainter::CompositionMode_Source);
m_pScribbleArea->refreshVector(path.boundingRect().toRect(), rad);
}
}
}
开发者ID:sarathms,项目名称:pencil,代码行数:77,代码来源:erasertool.cpp
示例10: defined
int VtModelParser::LoadCooked(
const xtime::TimeSlice &time,
Engine &engine,
const pkg::Asset::Ref &asset,
int flags
) {
if (m_state == kS_None) {
#if defined(RAD_OPT_TOOLS)
if (!asset->cooked) {
const String *s = asset->entry->KeyValue<String>("AnimStates.Source", P_TARGET_FLAGS(flags));
if (!s)
return SR_MetaError;
m_statesRef = engine.sys->packages->Resolve(s->c_str, asset->zone);
if (!m_statesRef)
return SR_FileNotFound;
int r = m_statesRef->Process(
xtime::TimeSlice::Infinite,
flags
);
if (r != SR_Success)
return r;
m_states = SkAnimStatesParser::Cast(m_statesRef);
if (!m_states || !m_states->valid)
return SR_ParseError;
} else {
#endif
const Package::Entry::Import *import = asset->entry->Resolve(0);
if (!import)
return SR_MetaError;
m_statesRef = asset->entry->Resolve(*import, asset->zone);
if (!m_statesRef)
return SR_FileNotFound;
int r = m_statesRef->Process(
xtime::TimeSlice::Infinite,
flags
);
if (r != SR_Success)
return r;
m_states = SkAnimStatesParser::Cast(m_statesRef);
if (!m_states || !m_states->valid)
return SR_ParseError;
#if defined(RAD_OPT_TOOLS)
}
#endif
m_state = kS_Load0;
}
if (m_state == kS_Load0) {
if (!m_mm[0]) {
#if defined(RAD_OPT_TOOLS)
if (!asset->cooked) {
m_cooker = asset->AllocateIntermediateCooker();
CookStatus status = m_cooker->Status(P_TARGET_FLAGS(flags));
if (status == CS_Ignore)
return SR_CompilerError;
if (status == CS_NeedRebuild) {
COut(C_Info) << asset->path.get() << " is out of date, rebuilding..." << std::endl;
int r = m_cooker->Cook(P_TARGET_FLAGS(flags));
if (r != SR_Success)
return r;
} else {
COut(C_Info) << asset->path.get() << " is up to date, using cache." << std::endl;
}
String path(CStr(asset->path));
path += ".0.bin";
m_mm[0] = m_cooker->MapFile(path.c_str, r::ZSkm);
if (!m_mm[0])
return SR_FileNotFound;
}
else {
#endif
String path(CStr("Cooked/"));
path += CStr(asset->path);
path += ".0.bin";
m_mm[0] = engine.sys->files->MapFile(path.c_str, r::ZSkm);
if (!m_mm[0])
return SR_FileNotFound;
#if defined(RAD_OPT_TOOLS)
}
#endif
}
m_state = kS_Load1;
}
if (m_state == kS_Load1) {
//.........这里部分代码省略.........
开发者ID:joeriedel,项目名称:Radiance,代码行数:101,代码来源:VtModelParser.cpp
示例11: compare
int compare(const value_type* s) const { return compare(path(s)); }
开发者ID:bredelings,项目名称:BAli-Phy,代码行数:1,代码来源:path.hpp
示例12:
path& operator/=(string_type& s) { return this->operator/=(path(s)); }
开发者ID:bredelings,项目名称:BAli-Phy,代码行数:1,代码来源:path.hpp
示例13: main
int
main (int argc, char **argv)
{
int msgp = 0, distsw = 0, vecp;
int isdf = 0, mime = 0;
int msgnum, status;
char *cp, *dfolder = NULL, *maildir = NULL;
char buf[BUFSIZ], **ap, **argp, **arguments, *program;
char *msgs[MAXARGS], **vec;
struct msgs *mp;
struct stat st;
if (nmh_init(argv[0], 1)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 1);
argp = arguments;
vec = argsplit(postproc, &program, &vecp);
vec[vecp++] = "-library";
vec[vecp++] = getcpy (m_maildir (""));
if ((cp = context_find ("fileproc"))) {
vec[vecp++] = "-fileproc";
vec[vecp++] = cp;
}
if ((cp = context_find ("mhlproc"))) {
vec[vecp++] = "-mhlproc";
vec[vecp++] = cp;
}
if ((cp = context_find ("credentials"))) {
/* post doesn't read context so need to pass credentials. */
vec[vecp++] = "-credentials";
vec[vecp++] = cp;
}
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch (++cp, switches)) {
case AMBIGSW:
ambigsw (cp, switches);
done (1);
case UNKWNSW:
adios (NULL, "-%s unknown\n", cp);
case HELPSW:
snprintf (buf, sizeof(buf), "%s [file] [switches]", invo_name);
print_help (buf, switches, 1);
done (0);
case VERSIONSW:
print_version(invo_name);
done (0);
case DRAFTSW:
msgs[msgp++] = draft;
continue;
case DFOLDSW:
if (dfolder)
adios (NULL, "only one draft folder at a time!");
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
*cp != '@' ? TFOLDER : TSUBCWF);
continue;
case DMSGSW:
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
msgs[msgp++] = cp;
continue;
case NDFLDSW:
dfolder = NULL;
isdf = NOTOK;
continue;
case PUSHSW:
pushsw++;
continue;
case NPUSHSW:
pushsw = 0;
continue;
case SPLITSW:
if (!(cp = *argp++) || sscanf (cp, "%d", &splitsw) != 1)
adios (NULL, "missing argument to %s", argp[-2]);
continue;
case UNIQSW:
unique++;
continue;
case NUNIQSW:
unique = 0;
continue;
case FORWSW:
forwsw++;
continue;
case NFORWSW:
//.........这里部分代码省略.........
开发者ID:dscho,项目名称:nmh,代码行数:101,代码来源:send.c
示例14: _restore
bool _restore(const std::string &project_name,
const std::string &storage_path, const std::string &history_path)
{
std::list<file_info> patch_list;
std::list<file_info> deletion_list;
std::list<file_info> addition_list;
std::list<file_info>::iterator iter;
size_t index;
if(!_read_list(history_path + "/patch_list", &patch_list))
return false;
if(!_read_list(history_path + "/deletion_list", &deletion_list))
return false;
if(!_read_list(history_path + "/addition_list", &addition_list))
return false;
//rsync patch
index = 0;
for(iter = patch_list.begin(); iter != patch_list.end(); ++iter)
{
std::string basis;
std::string patch;
std::string output;
basis = storage_path + "/" + iter->path;
patch = history_path + "/patch." + size2string(index);
output = project_name + "/tmp_ffbackup";
if(rsync_patch(basis, patch, output) == false)
{
rm_recursive(output);
return false;
}
if(rename(output.c_str(), basis.c_str()) < 0)
{
rm_recursive(output);
return false;
}
++index;
}
//process deletion list
for(iter = deletion_list.begin(); iter != deletion_list.end(); ++iter)
{
rm_recursive(storage_path + "/" + iter->path);
}
//process addition list
index = 0;
for(iter = addition_list.begin(); iter != addition_list.end(); ++iter)
{
std::string path(storage_path + "/" + iter->path);
bool ok;
if(iter->type == 'f')
ok = link_or_copy(history_path + "/" + size2string(index), path);
else if(iter->type == 'd')
ok = (0 == mkdir(path.c_str(), 0775));
else
ok = false;
if(!ok)
return false;
++index;
}
return true;
}
开发者ID:rayfung,项目名称:ffbackup-server,代码行数:65,代码来源:ffstorage.cpp
示例15: wxSetEnv
//! @brief Initializes the application.
//!
//! It will open the main window and connect default to server or open the connect window.
bool SpringLobbyApp::OnInit()
{
wxSetEnv( _T("UBUNTU_MENUPROXY"), _T("0") );
//this triggers the Cli Parser amongst other stuff
if (!wxApp::OnInit())
return false;
SetAppName( m_appname );
if (!m_crash_handle_disable) {
#if wxUSE_ON_FATAL_EXCEPTION
wxHandleFatalExceptions( true );
#endif
#if defined(__WXMSW__) && defined(ENABLE_DEBUG_REPORT)
//this undocumented function acts as a workaround for the dysfunctional
// wxUSE_ON_FATAL_EXCEPTION on msw when mingw is used (or any other non SEH-capable compiler )
SetUnhandledExceptionFilter(filter);
#endif
}
//initialize all loggers, we'll use the returned pointer to set correct parent window later
wxLogChain* logchain = 0;
wxLogWindow *loggerwin = InitializeLoggingTargets( 0, m_log_console, m_log_file_path, m_log_window_show, !m_crash_handle_disable, m_log_verbosity, logchain );
//this needs to called _before_ mainwindow instance is created
wxInitAllImageHandlers();
wxFileSystem::AddHandler(new wxZipFSHandler);
wxSocketBase::Initialize();
#ifdef __WXMSW__
wxString path = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + wxFileName::GetPathSeparator() + _T("locale");
#else
#if defined(LOCALE_INSTALL_DIR)
wxString path ( _T(LOCALE_INSTALL_DIR) );
#else
// use a dummy name here, we're only interested in the base path
wxString path = wxStandardPaths::Get().GetLocalizedResourcesDir(_T("noneWH"),wxStandardPaths::ResourceCat_Messages);
path = path.Left( path.First(_T("noneWH") ) );
#endif
#endif
m_translationhelper = new wxTranslationHelper( *( (wxApp*)this ), path );
m_translationhelper->Load();
if ( !wxDirExists( GetConfigfileDir() ) )
wxMkdir( GetConfigfileDir() );
#ifdef __WXMSW__
sett().SetSearchSpringOnlyInSLPath( sett().GetSearchSpringOnlyInSLPath() );
#endif
sett().SetSpringBinary( sett().GetCurrentUsedSpringIndex(), sett().GetCurrentUsedSpringBinary() );
sett().SetUnitSync( sett().GetCurrentUsedSpringIndex(), sett().GetCurrentUsedUnitSync() );
if ( sett().DoResetPerspectives() )
{
//we do this early on and reset the config var a little later so we can save a def. perps once mw is created
sett().RemoveLayouts();
sett().SetDoResetPerspectives( false );
ui().mw().SavePerspectives( _T("SpringLobby-default") );
}
sett().RefreshSpringVersionList();
//this should take off the firstload time considerably *ie nil it :P )
mapSelectDialog();
if ( !m_customizer_archive_name.IsEmpty() )
{//this needsto happen before usync load
sett().SetForcedSpringConfigFilePath( GetCustomizedEngineConfigFilePath() );
}
//unitsync first load, NEEDS to be blocking
const bool usync_loaded = usync().ReloadUnitSyncLib();
if ( !sett().IsFirstRun() && !usync_loaded )
{
customMessageBox( SL_MAIN_ICON, _("Please check that the file given in Preferences->Spring is a proper, readable unitsync library"),
_("Coulnd't load required unitsync library"), wxOK );
}
#ifndef DISABLE_SOUND
//sound sources/buffer init
sound();
#endif
CacheAndSettingsSetup();
if ( !m_customizer_archive_name.IsEmpty() ) {
if ( SLcustomizations().Init( m_customizer_archive_name ) ) {
ui().mw().SetIcons( SLcustomizations().GetAppIconBundle() );
}
else {
customMessageBox( SL_MAIN_ICON, _("Couldn't load customizations for ") + m_customizer_archive_name + _("\nPlease check that that is the correct name, passed in qoutation"), _("Fatal error"), wxOK );
// wxLogError( _("Couldn't load customizations for ") + m_customizer_archive_name + _("\nPlease check that that is the correct name, passed in qoutation"), _("Fatal error") );
exit( OnExit() );//for some twisted reason returning false here does not terminate the app
}
}
notificationManager(); //needs to be initialized too
ui().ShowMainWindow();
//.........这里部分代码省略.........
开发者ID:hoijui,项目名称:springlobby,代码行数:101,代码来源:springlobbyapp.cpp
示例16: DoClickPath
static void DoClickPath(
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output,
PF_EventExtra *event_extra,
ArbitraryData *arb_data,
SequenceData *seq_data)
{
ExtensionMap extensions;
for(int i=0; i < OCIO::FileTransform::getNumFormats(); i++)
{
const char *extension = OCIO::FileTransform::getFormatExtensionByIndex(i);
const char *format = OCIO::FileTransform::getFormatNameByIndex(i);
if(extension != std::string("ccc")) // .ccc files require an ID parameter
extensions[ extension ] = format;
}
extensions[ "ocio" ] = "OCIO Format";
void *hwndOwner = NULL;
#ifdef WIN_ENV
PF_GET_PLATFORM_DATA(PF_PlatData_MAIN_WND, &hwndOwner);
#endif
char c_path[ARB_PATH_LEN + 1] = { '\0' };
bool result = OpenFile(c_path, ARB_PATH_LEN, extensions, hwndOwner);
if(result)
{
Path path(c_path, GetProjectDir(in_data));
OpenColorIO_AE_Context *new_context = new OpenColorIO_AE_Context(path.full_path(),
OCIO_SOURCE_CUSTOM);
if(new_context == NULL)
throw OCIO::Exception("WTF?");
if(seq_data->context)
{
delete seq_data->context;
}
seq_data->context = new_context;
arb_data->source = seq_data->source = OCIO_SOURCE_CUSTOM;
strncpy(arb_data->path, path.full_path().c_str(), ARB_PATH_LEN);
strncpy(arb_data->relative_path, path.relative_path(false).c_str(), ARB_PATH_LEN);
strncpy(seq_data->path, arb_data->path, ARB_PATH_LEN);
strncpy(seq_data->relative_path, arb_data->relative_path, ARB_PATH_LEN);
// try to retain settings if it looks like the same situation,
// possibly fixing a moved path
if(OCIO_ACTION_NONE == arb_data->action ||
(OCIO_ACTION_LUT == new_context->getAction() && OCIO_ACTION_LUT != arb_data->action) ||
(OCIO_ACTION_LUT != new_context->getAction() && OCIO_ACTION_LUT == arb_data->action) ||
(OCIO_ACTION_LUT != new_context->getAction() &&
(-1 == FindInVec(new_context->getInputs(), arb_data->input) ||
-1 == FindInVec(new_context->getInputs(), arb_data->output) ||
-1 == FindInVec(new_context->getTransforms(), arb_data->transform) ||
-1 == FindInVec(new_context->getDevices(), arb_data->device) ) ) )
{
// Configuration is different, so initialize defaults
arb_data->action = seq_data->context->getAction();
if(arb_data->action == OCIO_ACTION_LUT)
{
arb_data->invert = FALSE;
arb_data->interpolation = OCIO_INTERP_LINEAR;
}
else
{
strncpy(arb_data->input, seq_data->context->getInput().c_str(), ARB_SPACE_LEN);
strncpy(arb_data->output, seq_data->context->getOutput().c_str(), ARB_SPACE_LEN);
strncpy(arb_data->transform, seq_data->context->getTransform().c_str(), ARB_SPACE_LEN);
strncpy(arb_data->device, seq_data->context->getDevice().c_str(), ARB_SPACE_LEN);
}
}
else
{
// Configuration is the same, retain current settings
if(arb_data->action == OCIO_ACTION_LUT)
{
seq_data->context->setupLUT(arb_data->invert, arb_data->interpolation);
}
else if(arb_data->action == OCIO_ACTION_CONVERT)
{
seq_data->context->setupConvert(arb_data->input, arb_data->output);
}
else if(arb_data->action == OCIO_ACTION_DISPLAY)
//.........这里部分代码省略.........
开发者ID:JGoldstone,项目名称:OpenColorIO,代码行数:101,代码来源:OpenColorIO_AE_UI.cpp
示例17: path_old
nglInputDevice* nglInputDeviceLinux::Enum (uint Index)
{
if (!mInitCalled)
{
App->AddExit(Exit);
mInitCalled = true;
}
if (!mpBasePath)
{
nglPath path_old(_T("/dev/js1"));
nglPath path_new(_T("/dev/input/js1"));
if (path_new.Exists())
mpBasePath = (nglChar*) _T("/dev/input/js");
else
if (path_old.Exists())
mpBasePath = (nglChar*) _T("/dev/js");
}
// No valid path to joystick devices
if (!mpBasePath)
return NULL;
uint i;
uint valid = 0;
bool found = false;
for (i = 0; !found; i++)
{
// Check existence of device node '{basepath}/js{i}'
nglStri
|
请发表评论