本文整理汇总了C++中Path函数的典型用法代码示例。如果您正苦于以下问题:C++ Path函数的具体用法?C++ Path怎么用?C++ Path使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsAbsolute
gcc_pure
bool IsAbsolute() const {
return Path(*this).IsAbsolute();
}
示例2: DebugAssert
//---------------------------------------------------------------------------
bool __fastcall TFileZillaIntf::MakeDir(const wchar_t* APath)
{
DebugAssert(FFileZillaApi != NULL);
CServerPath Path(APath);
return Check(FFileZillaApi->MakeDir(Path), L"makedir");
}
示例3: getpwuid
Path System::GetUserDir()
{
struct passwd* pw = getpwuid(getuid());
return Path(pw->pw_dir);
}
示例4: ERR_FAIL_COND
void AnimationCache::_update_cache() {
cache_valid = false;
ERR_FAIL_COND(!root);
ERR_FAIL_COND(!root->is_inside_tree());
ERR_FAIL_COND(animation.is_null());
for (int i = 0; i < animation->get_track_count(); i++) {
NodePath np = animation->track_get_path(i);
Node *node = root->get_node(np);
if (!node) {
path_cache.push_back(Path());
ERR_EXPLAIN("Invalid Track Path in Animation: " + np);
ERR_CONTINUE(!node);
}
Path path;
Ref<Resource> res;
if (animation->track_get_type(i) == Animation::TYPE_TRANSFORM) {
if (np.get_subname_count() > 1) {
path_cache.push_back(Path());
ERR_EXPLAIN("Transform tracks can't have a subpath: " + np);
ERR_CONTINUE(animation->track_get_type(i) == Animation::TYPE_TRANSFORM);
}
Spatial *sp = Object::cast_to<Spatial>(node);
if (!sp) {
path_cache.push_back(Path());
ERR_EXPLAIN("Transform track not of type Spatial: " + np);
ERR_CONTINUE(!sp);
}
if (np.get_subname_count() == 1) {
StringName property = np.get_subname(0);
String ps = property;
Skeleton *sk = Object::cast_to<Skeleton>(node);
if (!sk) {
path_cache.push_back(Path());
ERR_EXPLAIN("Property defined in Transform track, but not a Skeleton!: " + np);
ERR_CONTINUE(!sk);
}
int idx = sk->find_bone(ps);
if (idx == -1) {
path_cache.push_back(Path());
ERR_EXPLAIN("Property defined in Transform track, but not a Skeleton Bone!: " + np);
ERR_CONTINUE(idx == -1);
}
path.bone_idx = idx;
path.skeleton = sk;
}
path.spatial = sp;
} else {
if (np.get_subname_count() > 0) {
RES res2;
Vector<StringName> leftover_subpath;
// We don't want to cache the last resource unless it is a method call
bool is_method = animation->track_get_type(i) == Animation::TYPE_METHOD;
root->get_node_and_resource(np, res2, leftover_subpath, is_method);
if (res2.is_valid()) {
path.resource = res2;
} else {
path.node = node;
}
path.object = res2.is_valid() ? res2.ptr() : (Object *)node;
path.subpath = leftover_subpath;
} else {
path.node = node;
path.object = node;
path.subpath = np.get_subnames();
}
}
if (animation->track_get_type(i) == Animation::TYPE_VALUE) {
if (np.get_subname_count() == 0) {
path_cache.push_back(Path());
ERR_EXPLAIN("Value Track lacks property: " + np);
ERR_CONTINUE(np.get_subname_count() == 0);
}
//.........这里部分代码省略.........
示例5: Startup
/**
* "Boots" up XCSoar
* @param hInstance Instance handle
* @param lpCmdLine Command line string
* @return True if bootup successful, False otherwise
*/
bool
Startup()
{
VerboseOperationEnvironment operation;
#ifdef HAVE_DOWNLOAD_MANAGER
Net::DownloadManager::Initialise();
#endif
LogFormat("Display dpi=%u,%u", Display::GetXDPI(), Display::GetYDPI());
// Creates the main window
TopWindowStyle style;
if (CommandLine::full_screen)
style.FullScreen();
style.Resizable();
MainWindow *const main_window = CommonInterface::main_window =
new MainWindow();
main_window->Create(SystemWindowSize(), style);
if (!main_window->IsDefined())
return false;
#ifdef ENABLE_OPENGL
LogFormat("OpenGL: "
#ifdef ANDROID
#ifdef USE_EGL
"egl=native "
#else
"egl=no "
#endif
#endif
#ifdef HAVE_OES_DRAW_TEXTURE
"oesdt=%d "
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
"mda=%d "
#endif
"npot=%d vbo=%d fbo=%d stencil=%#x",
#ifdef HAVE_OES_DRAW_TEXTURE
OpenGL::oes_draw_texture,
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
GLExt::HaveMultiDrawElements(),
#endif
OpenGL::texture_non_power_of_two,
OpenGL::vertex_buffer_object,
OpenGL::frame_buffer_object,
OpenGL::render_buffer_stencil);
#endif
CommonInterface::SetUISettings().SetDefaults();
main_window->Initialise();
#ifdef SIMULATOR_AVAILABLE
// prompt for simulator if not set by command line argument "-simulator" or "-fly"
if (!sim_set_in_cmd_line_flag) {
SimulatorPromptResult result = dlgSimulatorPromptShowModal();
switch (result) {
case SPR_QUIT:
return false;
case SPR_FLY:
global_simulator_flag = false;
break;
case SPR_SIMULATOR:
global_simulator_flag = true;
break;
}
}
#endif
CommonInterface::SetSystemSettings().SetDefaults();
CommonInterface::SetComputerSettings().SetDefaults();
CommonInterface::SetUIState().Clear();
const auto &computer_settings = CommonInterface::GetComputerSettings();
const auto &ui_settings = CommonInterface::GetUISettings();
auto &live_blackboard = CommonInterface::GetLiveBlackboard();
if (!LoadProfile())
return false;
operation.SetText(_("Initialising"));
/* create XCSoarData on the first start */
CreateDataPath();
Display::LoadOrientation(operation);
main_window->CheckResize();
//.........这里部分代码省略.........
示例6: Path
HRESULT CHdmvClipInfo::ReadPlaylist(CString strPlaylistFile, REFERENCE_TIME& rtDuration, CAtlList<PlaylistItem>& Playlist)
{
CPath Path(strPlaylistFile);
rtDuration = 0;
// Get BDMV folder
Path.RemoveFileSpec();
Path.RemoveFileSpec();
m_hFile = CreateFile(strPlaylistFile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (m_hFile != INVALID_HANDLE_VALUE) {
BYTE Buff[100];
bool bDuplicate = false;
ReadBuffer(Buff, 4);
if (memcmp(Buff, "MPLS", 4)) {
return CloseFile(VFW_E_INVALID_FILE_FORMAT);
}
ReadBuffer(Buff, 4);
if ((memcmp(Buff, "0200", 4) != 0) && (memcmp(Buff, "0100", 4) != 0)) {
return CloseFile(VFW_E_INVALID_FILE_FORMAT);
}
LARGE_INTEGER Pos;
unsigned short nPlaylistItems;
Pos.QuadPart = ReadDword(); // PlayList_start_address
ReadDword(); // PlayListMark_start_address
// PlayList()
SetFilePointerEx(m_hFile, Pos, nullptr, FILE_BEGIN);
ReadDword(); // length
ReadShort(); // reserved_for_future_use
nPlaylistItems = ReadShort(); // number_of_PlayItems
ReadShort(); // number_of_SubPaths
Pos.QuadPart += 10;
for (size_t i = 0; i < nPlaylistItems; i++) {
DWORD dwTemp;
PlaylistItem Item;
SetFilePointerEx(m_hFile, Pos, nullptr, FILE_BEGIN);
Pos.QuadPart += ReadShort() + 2;
ReadBuffer(Buff, 5);
Item.m_strFileName.Format(_T("%s\\STREAM\\%c%c%c%c%c.M2TS"), Path, Buff[0], Buff[1], Buff[2], Buff[3], Buff[4]);
ReadBuffer(Buff, 4);
if (memcmp(Buff, "M2TS", 4)) {
return CloseFile(VFW_E_INVALID_FILE_FORMAT);
}
ReadBuffer(Buff, 3);
dwTemp = ReadDword();
Item.m_rtIn = 20000i64 * dwTemp / 90; // Carefull : 32->33 bits!
dwTemp = ReadDword();
Item.m_rtOut = 20000i64 * dwTemp / 90; // Carefull : 32->33 bits!
rtDuration += (Item.m_rtOut - Item.m_rtIn);
if (Playlist.Find(Item) != nullptr) {
bDuplicate = true;
}
Playlist.AddTail(Item);
//TRACE(_T("File : %s, Duration : %s, Total duration : %s\n"), strTemp, ReftimeToString (rtOut - rtIn), ReftimeToString (rtDuration));
}
CloseFile(S_OK);
return bDuplicate ? S_FALSE : S_OK;
}
return AmHresultFromWin32(GetLastError());
}
示例7: GetExtension
gcc_pure
const_pointer GetExtension() const {
return Path(*this).GetExtension();
}
示例8: WithExtension
gcc_pure
AllocatedPath WithExtension(const_pointer new_extension) const {
return Path(*this).WithExtension(new_extension);
}
示例9: RelativeTo
/**
* Check if this object is "inside" to the given path, and if yes,
* return the relative path.
*/
gcc_pure
Path RelativeTo(Path parent) const {
return Path(*this).RelativeTo(parent);
}
示例10: MatchesExtension
gcc_pure
bool MatchesExtension(const_pointer extension) const {
return Path(*this).MatchesExtension(extension);
}
示例11: GetBase
gcc_pure
Path GetBase() const {
return Path(*this).GetBase();
}
示例12: GetParent
AllocatedPath GetParent() const {
return Path(*this).GetParent();
}
示例13: IsBase
gcc_pure
bool IsBase() const {
return Path(*this).IsBase();
}
示例14: Path
Path DirectoryInfo::GetPath() const
{
return Path( m_path );
}
示例15: printf
void Being::adjustCourse(int srcX, int srcY, int dstX, int dstY)
{
if (debug_movement)
printf("%p adjustCourse(%d, %d, %d, %d)\n",
(void*) this, srcX, srcY, dstX, dstY);
mDest.x = dstX;
mDest.y = dstY;
// Find a path to the destination when it is at least a tile away
if (mMap && fabsf((mDest - mPos).length()) > 32) {
setPath(mMap->findPath((int) mPos.x / 32, (int) mPos.y / 32,
dstX / 32, dstY / 32, getWalkMask()));
} else {
setPath(Path());
}
// TODO: Evaluate the implementation of this method
/*
if (mX / 32 == dstX / 32 && mY / 32 == dstY / 32)
{
// The being is already on the last tile of the path.
Path p;
p.push_back(Position(dstX, dstY));
setPath(p);
return;
}
Path p1;
int p1_size, p1_length;
Uint16 *p1_dist;
int onPath = -1;
if (srcX / 32 == dstX / 32 && srcY / 32 == dstY / 32)
{
p1_dist = new Uint16[1];
p1_size = 1;
p1_dist[0] = 0;
p1_length = 0;
}
else
{
p1 = mMap->findPath(srcX / 32, srcY / 32, dstX / 32, dstY / 32, getWalkMask());
if (p1.empty())
{
// No path, but don't teleport since it could be user input.
setPath(p1);
return;
}
p1_size = p1.size();
p1_dist = new Uint16[p1_size];
int j = 0;
// Remove last tile so that it can be replaced by the exact destination.
p1.pop_back();
for (Path::iterator i = p1.begin(), i_end = p1.end(); i != i_end; ++i)
{
// Get distance from source to tile i.
p1_dist[j] = mMap->getMetaTile(i->x, i->y)->Gcost;
// Check if the being is already walking on the path.
if (i->x == mX / 32 && i->y == mY / 32)
{
onPath = j;
}
// Do not set any offset for intermediate steps.
i->x = i->x * 32;
i->y = i->y * 32;
++j;
}
p1_length = mMap->getMetaTile(dstX / 32, dstY / 32)->Gcost;
p1_dist[p1_size - 1] = p1_length;
}
p1.push_back(Position(dstX, dstY));
if (mX / 32 == srcX / 32 && mY / 32 == srcY / 32)
{
// The being is at the start of the path.
setPath(p1);
delete[] p1_dist;
return;
}
if (onPath >= 0)
{
// The being is already on the path, but it needs to be slowed down.
for (int j = onPath; j >= 0; --j)
{
p1.pop_front();
}
int r = p1_length - p1_dist[onPath]; // remaining length
assert(r > 0);
setPath(p1, p1_length * 1024 / r);
delete[] p1_dist;
return;
}
Path bestPath;
int bestRating = -1, bestStart = 0, bestLength = 0;
int j = 0;
for (Path::iterator i = p1.begin(), i_end = p1.end(); i != i_end; ++i)
{
//.........这里部分代码省略.........