本文整理汇总了C++中CharPointer_UTF8函数的典型用法代码示例。如果您正苦于以下问题:C++ CharPointer_UTF8函数的具体用法?C++ CharPointer_UTF8怎么用?C++ CharPointer_UTF8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CharPointer_UTF8函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CharPointer_UTF8
void StringArray::appendNumbersToDuplicates (bool ignoreCase,
bool appendNumberToFirstInstance,
CharPointer_UTF8 preNumberString,
CharPointer_UTF8 postNumberString)
{
if (preNumberString.getAddress() == nullptr)
preNumberString = CharPointer_UTF8 (" (");
if (postNumberString.getAddress() == nullptr)
postNumberString = CharPointer_UTF8 (")");
for (int i = 0; i < size() - 1; ++i)
{
auto& s = strings.getReference(i);
auto nextIndex = indexOf (s, ignoreCase, i + 1);
if (nextIndex >= 0)
{
auto original = s;
int number = 0;
if (appendNumberToFirstInstance)
s = original + String (preNumberString) + String (++number) + String (postNumberString);
else
++number;
while (nextIndex >= 0)
{
set (nextIndex, (*this)[nextIndex] + String (preNumberString) + String (++number) + String (postNumberString));
nextIndex = indexOf (original, ignoreCase, nextIndex + 1);
}
}
}
}
开发者ID:kmatheussen,项目名称:mammut,代码行数:34,代码来源:juce_StringArray.cpp
示例2: String
String MidiMessage::getTextFromTextMetaEvent() const
{
auto textData = reinterpret_cast<const char*> (getMetaEventData());
return String (CharPointer_UTF8 (textData),
CharPointer_UTF8 (textData + getMetaEventLength()));
}
开发者ID:DISTRHO,项目名称:DISTRHO-Ports,代码行数:7,代码来源:juce_MidiMessage.cpp
示例3: switch
File File::getSpecialLocation (const SpecialLocationType type)
{
switch (type)
{
case userHomeDirectory:
{
if (const char* homeDir = getenv ("HOME"))
return File (CharPointer_UTF8 (homeDir));
if (auto* pw = getpwuid (getuid()))
return File (CharPointer_UTF8 (pw->pw_dir));
return {};
}
case userDocumentsDirectory: return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~/Documents");
case userMusicDirectory: return resolveXDGFolder ("XDG_MUSIC_DIR", "~/Music");
case userMoviesDirectory: return resolveXDGFolder ("XDG_VIDEOS_DIR", "~/Videos");
case userPicturesDirectory: return resolveXDGFolder ("XDG_PICTURES_DIR", "~/Pictures");
case userDesktopDirectory: return resolveXDGFolder ("XDG_DESKTOP_DIR", "~/Desktop");
case userApplicationDataDirectory: return resolveXDGFolder ("XDG_CONFIG_HOME", "~/.config");
case commonDocumentsDirectory:
case commonApplicationDataDirectory: return File ("/opt");
case globalApplicationsDirectory: return File ("/usr");
case tempDirectory:
{
if (const char* tmpDir = getenv ("TMPDIR"))
return File (CharPointer_UTF8 (tmpDir));
return File ("/tmp");
}
case invokedExecutableFile:
if (juce_argv != nullptr && juce_argc > 0)
return File (CharPointer_UTF8 (juce_argv[0]));
// deliberate fall-through...
case currentExecutableFile:
case currentApplicationFile:
#if ! JUCE_STANDALONE_APPLICATION
return juce_getExecutableFile();
#endif
// deliberate fall-through if this is not a shared-library
case hostApplicationPath:
{
const File f ("/proc/self/exe");
return f.isSymbolicLink() ? f.getLinkedTarget() : juce_getExecutableFile();
}
default:
jassertfalse; // unknown type?
break;
}
return {};
}
开发者ID:mtytel,项目名称:JUCE,代码行数:58,代码来源:juce_linux_Files.cpp
示例4: header
void XmlDocument::skipHeader()
{
const int headerStart = input.indexOf (CharPointer_UTF8 ("<?xml"));
if (headerStart >= 0)
{
const int headerEnd = (input + headerStart).indexOf (CharPointer_UTF8 ("?>"));
if (headerEnd < 0)
return;
#if JUCE_DEBUG
const String header (input + headerStart, (size_t) (headerEnd - headerStart));
const String encoding (header.fromFirstOccurrenceOf ("encoding", false, true)
.fromFirstOccurrenceOf ("=", false, false)
.fromFirstOccurrenceOf ("\"", false, false)
.upToFirstOccurrenceOf ("\"", false, false).trim());
/* If you load an XML document with a non-UTF encoding type, it may have been
loaded wrongly.. Since all the files are read via the normal juce file streams,
they're treated as UTF-8, so by the time it gets to the parser, the encoding will
have been lost. Best plan is to stick to utf-8 or if you have specific files to
read, use your own code to convert them to a unicode String, and pass that to the
XML parser.
*/
jassert (encoding.isEmpty() || encoding.startsWithIgnoreCase ("utf-"));
#endif
input += headerEnd + 2;
}
skipNextWhiteSpace();
const int docTypeIndex = input.indexOf (CharPointer_UTF8 ("<!DOCTYPE"));
if (docTypeIndex < 0)
return;
input += docTypeIndex + 9;
const String::CharPointerType docType (input);
int n = 1;
while (n > 0)
{
const juce_wchar c = readNextChar();
if (outOfData)
return;
if (c == '<')
++n;
else if (c == '>')
--n;
}
dtdText = String (docType, (size_t) (input.getAddress() - (docType.getAddress() + 1))).trim();
}
开发者ID:PFCM,项目名称:SwivelAutotune,代码行数:56,代码来源:juce_XmlDocument.cpp
示例5: switch
File File::getSpecialLocation (const SpecialLocationType type)
{
switch (type)
{
case userHomeDirectory:
{
const char* homeDir = getenv ("HOME");
if (homeDir)
return File (CharPointer_UTF8 (homeDir));
if (struct passwd* const pw = getpwuid (getuid()))
return File (CharPointer_UTF8 (pw->pw_dir));
return File (CharPointer_UTF8 (homeDir));
}
case userDocumentsDirectory:
return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~");
case userMusicDirectory:
return resolveXDGFolder ("XDG_MUSIC_DIR", "~");
case userMoviesDirectory:
return resolveXDGFolder ("XDG_VIDEOS_DIR", "~");
case userPicturesDirectory:
return resolveXDGFolder ("XDG_PICTURES_DIR", "~");
case userDesktopDirectory:
return resolveXDGFolder ("XDG_DESKTOP_DIR", "~/Desktop");
case userApplicationDataDirectory:
return File ("~");
case commonDocumentsDirectory:
case commonApplicationDataDirectory:
return File ("/var");
case globalApplicationsDirectory:
return File ("/usr");
case tempDirectory:
{
File tmp ("/var/tmp");
if (! tmp.isDirectory())
{
tmp = "/tmp";
if (! tmp.isDirectory())
tmp = File::getCurrentWorkingDirectory();
}
return tmp;
}
default:
bassertfalse; // unknown type?
break;
}
return File::nonexistent ();
}
开发者ID:alexandrev,项目名称:rippled,代码行数:56,代码来源:linux_Files.cpp
示例6: CharPointer_UTF8
//==============================================================================
String SystemStats::getLogonName()
{
if (const char* user = getenv ("USER"))
return CharPointer_UTF8 (user);
if (struct passwd* const pw = getpwuid (getuid()))
return CharPointer_UTF8 (pw->pw_name);
return String();
}
开发者ID:0x4d52,项目名称:JUCE,代码行数:11,代码来源:juce_android_SystemStats.cpp
示例7: while
void XmlDocument::skipNextWhiteSpace()
{
for (;;)
{
juce_wchar c = *input;
while (CharacterFunctions::isWhitespace (c))
c = *++input;
if (c == 0)
{
outOfData = true;
break;
}
else if (c == '<')
{
if (input[1] == '!'
&& input[2] == '-'
&& input[3] == '-')
{
input += 4;
const int closeComment = input.indexOf (CharPointer_UTF8 ("-->"));
if (closeComment < 0)
{
outOfData = true;
break;
}
input += closeComment + 3;
continue;
}
else if (input[1] == '?')
{
input += 2;
const int closeBracket = input.indexOf (CharPointer_UTF8 ("?>"));
if (closeBracket < 0)
{
outOfData = true;
break;
}
input += closeBracket + 2;
continue;
}
}
break;
}
}
开发者ID:PFCM,项目名称:SwivelAutotune,代码行数:51,代码来源:juce_XmlDocument.cpp
示例8: getMouseXYRelative
void FilterGraph::mouseMove (const MouseEvent &event)
{
Point <int> mousePos = getMouseXYRelative();
int xPos = mousePos.getX();
float freq = xToFreq (xPos);
if (traceType == Magnitude)
{
float magnitude = (float) (filterVector [0].getResponse (freq).magnitudeValue);
for (int i = 1; i < numFilters; i++)
{
magnitude *= (float) (filterVector [i].getResponse (freq).magnitudeValue);
}
magnitude = 20 * log10 (magnitude);
setTooltip (String (freq, 1) + "Hz, " + String (magnitude, 1) + "dB");
}
if (traceType == Phase)
{
float phase = (float) (filterVector [0].getResponse (freq).phaseValue);
for (int i = 1; i < numFilters; i++)
{
phase += (float) (filterVector [i].getResponse (freq).phaseValue);
}
phase /= float_Pi;
setTooltip (String (freq, 1) + "Hz, " + String (phase, 2) + String (CharPointer_UTF8 ("\xcf\x80")) + "rad");
}
}
开发者ID:JordanTHarris,项目名称:TransposedDirectFormIIFilter,代码行数:34,代码来源:FilterGraph.cpp
示例9: next
bool next (String& filenameFound,
bool* const isDir, bool* const isHidden, std::int64_t* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
if (dir != nullptr)
{
const char* wildcardUTF8 = nullptr;
for (;;)
{
struct dirent* const de = readdir (dir);
if (de == nullptr)
break;
if (wildcardUTF8 == nullptr)
wildcardUTF8 = wildCard.toUTF8();
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{
filenameFound = CharPointer_UTF8 (de->d_name);
updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly);
if (isHidden != nullptr)
*isHidden = filenameFound.startsWithChar ('.');
return true;
}
}
}
return false;
}
开发者ID:alexandrev,项目名称:rippled,代码行数:34,代码来源:linux_Files.cpp
示例10: parseNameRecord
static String parseNameRecord (MemoryInputStream& input, const NameRecord& nameRecord,
const int64 directoryOffset, const int64 offsetOfStringStorage)
{
String result;
const int64 oldPos = input.getPosition();
input.setPosition (directoryOffset + offsetOfStringStorage + ByteOrder::swapIfLittleEndian (nameRecord.offsetFromStorageArea));
const int stringLength = (int) ByteOrder::swapIfLittleEndian (nameRecord.stringLength);
const int platformID = ByteOrder::swapIfLittleEndian (nameRecord.platformID);
if (platformID == 0 || platformID == 3)
{
const int numChars = stringLength / 2 + 1;
HeapBlock<uint16> buffer;
buffer.calloc (numChars + 1);
input.read (buffer, stringLength);
for (int i = 0; i < numChars; ++i)
buffer[i] = ByteOrder::swapIfLittleEndian (buffer[i]);
static_jassert (sizeof (CharPointer_UTF16::CharType) == sizeof (uint16));
result = CharPointer_UTF16 ((CharPointer_UTF16::CharType*) buffer.getData());
}
else
{
HeapBlock<char> buffer;
buffer.calloc (stringLength + 1);
input.read (buffer, stringLength);
result = CharPointer_UTF8 (buffer.getData());
}
input.setPosition (oldPos);
return result;
}
开发者ID:410pfeliciano,项目名称:plugin-GUI,代码行数:33,代码来源:juce_win32_Fonts.cpp
示例11: lilv_plugin_get_required_features
bool
LV2World::isPluginSupported (const LilvPlugin* plugin)
{
// Required features support
LilvNodes* nodes = lilv_plugin_get_required_features (plugin);
LILV_FOREACH (nodes, iter, nodes)
{
const LilvNode* node (lilv_nodes_get (nodes, iter));
if (! isFeatureSupported (CharPointer_UTF8 (lilv_node_as_uri (node)))) {
return false; // Feature not supported
}
}
lilv_nodes_free (nodes); nodes = nullptr;
// Check this plugin's port types are supported
const uint32 numPorts = lilv_plugin_get_num_ports (plugin);
for (uint32 i = 0; i < numPorts; ++i)
{
// const LilvPort* port (lilv_plugin_get_port_by_index (plugin, i));
// nothing here yet (or ever)
}
return true;
}
开发者ID:lvtk,项目名称:lvtk-juce,代码行数:25,代码来源:lvtk_LV2World.cpp
示例12: myFont
MainContentComponent::MainContentComponent()
: myFont (Typeface::createSystemTypefaceFor (BinaryData::myFont_ttf, BinaryData::myFont_ttfSize)),
myText (CharPointer_UTF8 ("H\xe2\x84\xae\xc5\x82\xc5\x82o W\xe2\x98\xba\xd2\x91\xc5\x82""d"))
{
myFont.setHeight (100.0f);
setSize (600, 400);
}
开发者ID:tomotello,项目名称:JUCE_SummitExamples,代码行数:8,代码来源:MainComponent.cpp
示例13: CharPointer_UTF8
String
LV2Module::getClassLabel() const
{
if (const LilvPluginClass* klass = lilv_plugin_get_class (plugin))
if (const LilvNode* node = lilv_plugin_class_get_label (klass))
return CharPointer_UTF8 (lilv_node_as_string (node));
return String::empty;
}
开发者ID:lvtk,项目名称:lvtk-juce,代码行数:8,代码来源:lvtk_LV2Module.cpp
示例14: String
String StringPool::getPooledString (const char* const newString)
{
if (newString == nullptr || *newString == 0)
return String();
const ScopedLock sl (lock);
garbageCollectIfNeeded();
return addPooledString (strings, CharPointer_UTF8 (newString));
}
开发者ID:Snaptags,项目名称:MIDI2LR,代码行数:9,代码来源:juce_StringPool.cpp
示例15: buffer
String InputStream::readString()
{
MemoryBlock buffer (256);
char* data = static_cast<char*> (buffer.getData());
size_t i = 0;
while ((data[i] = readByte()) != 0)
{
if (++i >= buffer.getSize())
{
buffer.setSize (buffer.getSize() + 512);
data = static_cast<char*> (buffer.getData());
}
}
return String (CharPointer_UTF8 (data),
CharPointer_UTF8 (data + i));
}
开发者ID:AchimTuran,项目名称:KlangFalter,代码行数:18,代码来源:juce_InputStream.cpp
示例16: next
bool next()
{
if (ports == nullptr || ports [index + 1] == nullptr)
return false;
name = CharPointer_UTF8 (ports[++index]);
clientName = name.upToFirstOccurrenceOf (":", false, false);
return true;
}
开发者ID:COx2,项目名称:JUCE_JAPAN_DEMO,代码行数:9,代码来源:juce_linux_JackAudio.cpp
示例17: getenv
//==============================================================================
String SystemStats::getLogonName()
{
const char* user = getenv ("USER");
if (user == nullptr)
if (passwd* const pw = getpwuid (getuid()))
user = pw->pw_name;
return CharPointer_UTF8 (user);
}
开发者ID:dyguan372,项目名称:rippled,代码行数:11,代码来源:linux_SystemStats.cpp
示例18: CharPointer_UTF8
bool MemoryOutputStream::appendUTF8Char (juce_wchar c)
{
if (char* dest = prepareToWrite (CharPointer_UTF8::getBytesRequiredFor (c)))
{
CharPointer_UTF8 (dest).write (c);
return true;
}
return false;
}
开发者ID:DISTRHO,项目名称:DISTRHO-Ports,代码行数:10,代码来源:juce_MemoryOutputStream.cpp
示例19: name
String
LV2Module::getAuthorName() const
{
if (LilvNode* node = lilv_plugin_get_author_name (plugin))
{
String name (CharPointer_UTF8 (lilv_node_as_string (node)));
lilv_node_free (node);
return name;
}
return String::empty;
}
开发者ID:lvtk,项目名称:lvtk-juce,代码行数:11,代码来源:lvtk_LV2Module.cpp
示例20: getenv
//==============================================================================
String SystemStats::getLogonName()
{
const char* user = getenv ("USER");
if (user == 0)
{
struct passwd* const pw = getpwuid (getuid());
if (pw != 0)
user = pw->pw_name;
}
return CharPointer_UTF8 (user);
}
开发者ID:wwiabs,项目名称:SimpleDJ,代码行数:14,代码来源:juce_android_SystemStats.cpp
注:本文中的CharPointer_UTF8函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论