本文整理汇总了C++中wxString::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Clone方法的具体用法?C++ wxString::Clone怎么用?C++ wxString::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTitle
// タイトルをセットする
void CMenuPart::setTitle(const wxString& title)
{
m_title = title.Clone();
}
示例2: AddTree
bool wxFsEventsFileSystemWatcher::AddTree(const wxFileName& path, int events,
const wxString& filespec)
{
if (!path.DirExists())
{
return false;
}
wxString canonical = GetCanonicalPath(path);
if ( canonical.empty() )
{
return false;
}
CFRunLoopRef cfLoop = CFRunLoopGetCurrent();
wxASSERT_MSG(
cfLoop,
"there must be a current event loop; this file watcher needs it."
);
if ( ! cfLoop )
{
return false;
}
if ( m_streams.find(canonical) != m_streams.end() )
{
// How to take into account filespec
// if client adds a watch for /home/*.cpp
// and then on another call wants to add a
// call to /home/*.h
// Ideally we should not create another watch
// however we would need to keep both filespecs
// around, which we don't do now.
return false;
}
// Will need to pass the desired event flags
// and filespec to our callback via the context
// we make sure to give the context a cleanup
// callback.
FSEventStreamContext ctx;
wxFSEventWatcherContext* watcherContext = new wxFSEventWatcherContext(
this, events, filespec.Clone()
);
ctx.version = 0;
ctx.info = watcherContext;
ctx.retain = NULL;
ctx.release = &wxDeleteContext;
ctx.copyDescription = NULL;
CFTimeInterval latency = 0.2;
wxMacUniCharBuffer pathChars(path.GetPath());
CFStringRef pathRef = CFStringCreateWithCharacters(
kCFAllocatorDefault,
pathChars.GetBuffer(),
pathChars.GetChars()
);
CFArrayRef pathRefs = CFArrayCreate(
kCFAllocatorDefault, (const void**)&pathRef, 1, NULL
);
FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot
| kFSEventStreamCreateFlagFileEvents;
FSEventStreamRef stream = FSEventStreamCreate(
kCFAllocatorDefault,
&wxFSEventCallback,
&ctx,
pathRefs, kFSEventStreamEventIdSinceNow,
latency, flags);
bool started = false;
if ( stream )
{
FSEventStreamScheduleWithRunLoop(stream, cfLoop, kCFRunLoopDefaultMode);
started = FSEventStreamStart(stream);
if ( started )
{
m_streams[canonical] = stream;
}
}
// cleanup the paths, as we own the pointers
CFRelease(pathRef);
CFRelease(pathRefs);
wxASSERT_MSG(stream, "could not create FS stream");
return started;
}