本文整理汇总了C++中VString::GetCPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::GetCPointer方法的具体用法?C++ VString::GetCPointer怎么用?C++ VString::GetCPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::GetCPointer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetKeysFromPath
/*
static
*/
void VValueBag::GetKeysFromPath( const VString& inPath, StKeyPath& outKeys)
{
VFromUnicodeConverter_UTF8 converter;
char buffer[256];
VIndex charsConsumed;
VSize bytesProduced;
const UniChar *begin = inPath.GetCPointer();
const UniChar *end = begin + inPath.GetLength();
for( const UniChar *pos = begin ; pos != end ; ++pos)
{
if (*pos == '/')
{
bool ok = converter.Convert( begin, (VIndex) (pos - begin), &charsConsumed, buffer, sizeof( buffer), &bytesProduced);
if (ok)
{
outKeys.push_back( StKey( buffer, bytesProduced));
}
begin = pos + 1;
}
}
if (begin != end)
{
bool ok = converter.Convert( begin, (VIndex) (end - begin), &charsConsumed, buffer, sizeof( buffer), &bytesProduced);
if (ok)
{
outKeys.push_back( StKey( buffer, bytesProduced));
}
}
}
示例2: parseOneLineByLex
void VXMLSyntax::parseOneLineByLex(ICodeEditorDocument *&inDocument, sLONG inLineNumber,struct xmlLexStyleInfo *&inputstruct)
{
VString xstr;
inDocument->GetLine(inLineNumber,xstr);
const UniChar * unistring = xstr.GetCPointer();
char *lexinput;
sLONG len = xstr.GetLength();
lexinput = new char[len+1];
lexinput[len] = '\0';
for(int i = 0 ; i < len ; i++) //to change unicode to char
{
if ( unistring[i] == 9 )
{
lexinput[i] = ' ';
}
else if (unistring[i] > 127)
{
lexinput[i] = 'X';
}
else
{
lexinput[i] = (char)unistring[i];
}
}
inputstruct = startxmlParse(lexinput);
delete lexinput;
}
示例3: JSValueMakeNull
JS4D::ValueRef JS4D::VStringToValue( ContextRef inContext, const VString& inString)
{
if (inString.IsNull())
return JSValueMakeNull( inContext);
JSStringRef jsString = JSStringCreateWithCharacters( inString.GetCPointer(), inString.GetLength());
ValueRef value = JSValueMakeString( inContext, jsString);
JSStringRelease( jsString);
return value;
}
示例4: Parse
bool VXMLParser::Parse( const VString& inText, IXMLHandler *inHandler, XMLParsingOptions inOptions)
{
xercesc::MemBufInputSource source( (const XMLByte *) inText.GetCPointer(), inText.GetLength() * sizeof( UniChar), "frommem");
#if BIGENDIAN
source.setEncoding( xercesc::XMLUni::fgUTF16BEncodingString);
#else
source.setEncoding( xercesc::XMLUni::fgUTF16LEncodingString);
#endif
return SAXParse( this, source, inHandler, inOptions);
}
示例5: NeedsEscapeSequence
bool VValueBag::NeedsEscapeSequence( const VString& inText, const UniChar* inEscapeFirst, const UniChar* inEscapeLast)
{
bool found = false;
for( const UniChar *ptr = inText.GetCPointer() ; *ptr && !found ; ++ptr)
{
for (const UniChar* pEscape = inEscapeFirst ; (pEscape != inEscapeLast) && !found ; ++pEscape)
{
found = (*ptr == *pEscape);
}
}
return found;
}
示例6: findStopLoc
int VXMLSyntax::findStopLoc(ICodeEditorDocument* inDocument,int inLineNumber,int commenttype)
{
VString xstr;
inDocument->GetLine(inLineNumber,xstr);
const UniChar * unistringtemp = xstr.GetCPointer();
int stoploc = 0;
if ( commenttype == ordinarycomment)
{
for (int i = 0;i < xstr.GetLength()-1;i++)
{
if (unistringtemp[i] == '*' && unistringtemp[i+1] == '/')
{
stoploc = i+1;
break;
}
if (unistringtemp[i] == '/' && unistringtemp[i+1] == '*')
{
stoploc = i +1;
break;
}
}
}
else if ( commenttype == htmlsytlecomment )
{
for (int i = 0;i < xstr.GetLength()-3;i++)
{
// char c = unistringtemp[i];
if (unistringtemp[i+1] == '-' && unistringtemp[i+2] == '-' && unistringtemp[i+3] == '>')
{
stoploc = i+2;
break;
}
if (unistringtemp[i] == '<' && unistringtemp[i+1] == '!' && unistringtemp[i+2] == '-'&& unistringtemp[i+3] == '-')
{
stoploc = i + 3;
break;
}
}
}
return stoploc;
}
示例7: StartWatchingForChanges
VError XWinFileSystemNotification::StartWatchingForChanges( const VFolder &inFolder, VFileSystemNotifier::EventKind inKindFilter, VFileSystemNotifier::IEventHandler *inHandler, sLONG inLatency )
{
VString path;
inFolder.GetPath( path );
VError err = VE_OK;
// Now that we know we need to care about this folder, let's see if we can create an entry for it. First,
// we will try to open a handle to the folder.
HANDLE hFolder = ::CreateFileW( path.GetCPointer(), FILE_LIST_DIRECTORY | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL );
if (hFolder == INVALID_HANDLE_VALUE)
{
// We were unable to open the folder, so we need to bail out
return MAKE_NATIVE_VERROR( ::GetLastError() );
}
// launch our task if not already there
LaunchTaskIfNecessary();
// Now that we've opened the folder handle, we can add an entry to our watch list
XWinChangeData *data = new XWinChangeData( inFolder.GetPath(), inKindFilter, VTask::GetCurrent(), inHandler, this);
data->fFolderHandle = hFolder;
data->fLatency = inLatency;
data->fOverlapped.hEvent = ::CreateEvent( NULL, true, false, NULL );
data->fTimer = NULL;
if (inLatency)
data->fTimer = ::CreateWaitableTimer( NULL, FALSE, NULL );
// Add the new data to our list of things to watch for
fOwner->PushChangeData( data );
WatchForChanges( data );
ReleaseRefCountable( &data);
return VE_OK;
}
示例8: ParseSpanText
/** parse span text element or XHTML fragment
@param inTaggedText
tagged text to parse (span element text only if inParseSpanOnly == true, XHTML fragment otherwise)
@param outStyles
parsed styles
@param outPlainText
parsed plain text
@param inParseSpanOnly
true (default): only <span> element(s) with CSS styles are parsed
false: all XHTML text fragment is parsed (parse also mandatory HTML text styles)
*/
void VSpanTextParser::ParseSpanText( const VString& inTaggedText, VTreeTextStyle*& outStyles, VString& outPlainText, bool inParseSpanOnly)
{
outPlainText = "";
if(outStyles)
outStyles->Release();
outStyles = NULL;
if (inTaggedText.IsEmpty())
return;
//fixed ACI0076343: for compatibility with older bases which do not have support for multistyle var or field
// we need to convert to xml text the text which is not bracketed with SPAN
// otherwise parser would fail
VString vtext;
sLONG posStartSPAN = 1; //pos of first SPAN tag
sLONG posEndSPAN = inTaggedText.GetLength()+1; //pos of character following ending SPAN tag
if (inParseSpanOnly)
{
//search for opening SPAN tag
posStartSPAN = inTaggedText.Find("<SPAN", 1, false);
if (!posStartSPAN)
{
//convert full text to xml
inTaggedText.GetXMLString( vtext, XSO_Default);
vtext = VString("<SPAN>")+vtext+"</SPAN>";
}
else
{
VString before, after;
if (posStartSPAN > 1)
{
//convert to XML text preceeding first SPAN
VString temp;
inTaggedText.GetSubString( 1, posStartSPAN-1, temp);
temp.GetXMLString( before, XSO_Default);
}
//search for ending SPAN tag
const UniChar *c = inTaggedText.GetCPointer()+inTaggedText.GetLength()-1;
sLONG pos = inTaggedText.GetLength()-1;
VString spanEndTag = "</SPAN>";
VString spanEndTag2 = "</span>";
do
{
while (pos >= 0 && *c != '>')
{
pos--;
if (pos >= 0)
c--;
}
if (pos >= 0)
{
if (memcmp( (void*)(c+1-spanEndTag.GetLength()), spanEndTag.GetCPointer(), spanEndTag.GetLength()*sizeof(UniChar)) == 0
||
memcmp( (void*)(c+1-spanEndTag2.GetLength()), spanEndTag2.GetCPointer(), spanEndTag2.GetLength()*sizeof(UniChar)) == 0)
{
posEndSPAN = pos+2;
break;
}
else
{
pos--;
if (pos >= 0)
c--;
}
}
} while (pos >= 0);
if (posEndSPAN <= inTaggedText.GetLength())
{
//convert to XML text following ending SPAN tag
VString temp;
inTaggedText.GetSubString( posEndSPAN, inTaggedText.GetLength()-posEndSPAN+1, temp);
temp.GetXMLString( after, XSO_Default);
}
if (!before.IsEmpty() || !after.IsEmpty())
{
inTaggedText.GetSubString( posStartSPAN, posEndSPAN-posStartSPAN, vtext);
vtext = VString("<SPAN>")+before+vtext+after+"</SPAN>";
}
else
vtext = VString("<SPAN>")+inTaggedText+"</SPAN>";
}
}
else
vtext = inTaggedText;
vtext.ExchangeAll(0x0B,0x0D);//[MI] le 28/12/2010 ACI0069253
#if VERSIONWIN
vtext.ConvertCarriageReturns(eCRM_CR); //important here on Windows before parsing because styles are assumed to use one character size for line ending on any platform
//and so pair of 0x0D 0x0A should be treated as a single 0x0D character
#endif
VTaggedTextSAXHandler vsaxhandler(outStyles, &outPlainText, inParseSpanOnly);
//.........这里部分代码省略.........
示例9: FormatDate
void XWinIntlMgr::FormatDate( const VTime& inDate, VString& outDate, EOSFormats inFormat, bool inUseGMTTimeZoneForDisplay)
{
// Prepare SYSTEMTIME for windows.
sWORD YY = 0;
sWORD MM = 0;
sWORD DD = 0;
sWORD hh = 0;
sWORD mm = 0;
sWORD ss = 0;
sWORD ms = 0;
if (inUseGMTTimeZoneForDisplay)
inDate.GetUTCTime (YY,MM,DD,hh,mm,ss,ms);
else
inDate.GetLocalTime (YY,MM,DD,hh,mm,ss,ms);
// Verify if date >1st Jan 1601 (GetDateFormat doesn't support earlier dates.
if (YY>=1601)
{
// Let the OS do it's job.
UniChar acBuffer[256];
SYSTEMTIME osDate={0};
osDate.wYear=YY;
osDate.wMonth=MM;
osDate.wDay=DD;
osDate.wHour=hh;
osDate.wMinute=mm;
osDate.wSecond=ss;
osDate.wMilliseconds=ms;
if (inFormat == eOS_MEDIUM_FORMAT)
{
VString pattern;
if (GetLocaleInfo( LOCALE_SLONGDATE, pattern))
{
// replace long month and date by medium ones
pattern.ExchangeRawString( CVSTR( "MMMM"), CVSTR( "MMM"));
pattern.ExchangeRawString( CVSTR( "dddd"), CVSTR( "ddd"));
if (::GetDateFormatW( fDialect, 0, &osDate, pattern.GetCPointer(), acBuffer, sizeof(acBuffer)))
outDate = acBuffer;
}
}
else
{
// Let the OS do the stuff.
DWORD dateFormat = (inFormat == eOS_SHORT_FORMAT) ? DATE_SHORTDATE : DATE_LONGDATE;
if (::GetDateFormatW(fDialect,dateFormat,&osDate,NULL,acBuffer,sizeof(acBuffer)))
outDate = acBuffer;
}
}
else
{
// Get the date pattern
VString pattern;
if (GetLocaleInfo( (inFormat == eOS_LONG_FORMAT) ? LOCALE_SLONGDATE : LOCALE_SSHORTDATE, pattern))
{
XBOX::VString tokens="gyMd";
UniChar oldToken=0;
sLONG count=0;
pattern.AppendChar(' ');
sLONG YY2=YY%100;
XBOX::VString oneName;
for (int pos=0;pos<pattern.GetLength();pos++)
{
UniChar token=pattern[pos];
if (tokens.FindUniChar(token)>=1)
{
if (token==oldToken)
count++;
else
{
if (!count)
{
count=1;
oldToken=token;
}
}
}
if (count && token!=oldToken)
{
switch(oldToken)
{
case 'g':
if (count==2)
{
// TODO: ERA will be added if really wanted.
}
else
{
for (int i=0;i<count;i++)
outDate.AppendUniChar(oldToken);
}
break;
case 'y': // YEAR
switch(count)
{
case 5:
case 4: // 4 or more digits date
//.........这里部分代码省略.........
示例10: FontExists
/** return true if font with the specified font family name, style and size exists on the current system */
bool VFont::FontExists(const VString& inFontFamilyName, const VFontFace& inFace, GReal inSize, const GReal inDPI, const VGraphicContext *inGC)
{
#if VERSIONWIN
bool exists = false;
//JQ 21/06/2010: fixed and optimized FontExists (was not coherent with font creation)
VFont *font = RetainFont( inFontFamilyName, inFace, inSize, inDPI, true);
if (font)
{
if (!font->IsTrueTypeFont())
{
//not TrueType fonts are drawed with GDI
//so return true if a valid HFONT is set
HFONT hFont = font->GetFontRef();
exists = hFont != NULL;
font->Release();
return exists;
}
#if ENABLE_D2D
if (inGC && inGC->IsD2DImpl())
{
//if DWrite font family name is not equal to inFontFamilyName
//DWrite has returned a compatible font
//so return true only if DWrite font family name matches inFontFamilyName
VTaskLock lock(&VWinD2DGraphicContext::GetMutexDWriteFactory());
exists = false;
if (font->GetImpl().GetDWriteTextFormat() != NULL)
{
UINT32 nameLength = font->GetImpl().GetDWriteTextFormat()->GetFontFamilyNameLength();
if (nameLength+1 <= 80)
{
WCHAR familyName[80];
HRESULT hr = font->GetImpl().GetDWriteTextFormat()->GetFontFamilyName( familyName, nameLength+1);
exists = wcscmp( inFontFamilyName.GetCPointer(), familyName) == 0;
}
else
{
WCHAR *familyName = new WCHAR[nameLength+1];
font->GetImpl().GetDWriteTextFormat()->GetFontFamilyName( familyName, nameLength+1);
exists = wcscmp( inFontFamilyName.GetCPointer(), familyName) == 0;
delete [] familyName;
}
}
font->Release();
return exists;
}
#endif
//if gdiplus font family name is not equal to inFontFamilyName
//gdiplus has returned a compatible font
//so return true only if gdiplus font family name matches inFontFamilyName
Gdiplus::FontFamily *family = new Gdiplus::FontFamily();
Gdiplus::Status status = font->GetImpl().GetGDIPlusFont()->GetFamily(family);
WCHAR familyName[LF_FACESIZE];
family->GetFamilyName( familyName);
exists = wcscmp( inFontFamilyName.GetCPointer(), familyName) == 0;
delete family;
font->Release();
}
return exists;
#else
bool exists = false;
VFont *font = RetainFont( inFontFamilyName, inFace, inSize, inDPI, true);
if (font)
{
//ensure returned font has the requested family name (here we check only the family name but not the full name)
//otherwise it is a font substitute
CTFontRef ctfont = font->GetFontRef();
CFStringRef name = CTFontCopyFamilyName(ctfont);
VString xname;
xname.MAC_FromCFString( name);
CFRelease(name);
VString inname( inFontFamilyName);
inname.Truncate( xname.GetLength());
return inname.EqualToString( xname);
}
return exists;
#endif
}
示例11: JSStringCreateWithCharacters
JS4D::StringRef JS4D::VStringToString( const VString& inString)
{
JSStringRef jsString = JSStringCreateWithCharacters( inString.GetCPointer(), inString.GetLength());
return jsString;
}
示例12: SetLine
void VXMLSyntax::SetLine( ICodeEditorDocument* inDocument, sLONG inLineNumber, bool inLoading )
{
int linekind_comment_aboveline = 0;
int linekind_comment_curline_cur = 0;
int linekind_comment_curline_former = 0;
bool NeedTocheckCommet = false; //use as a flag whether we should check scommet
int checkType = 0; //check in which situation of the scomment
if ( inLineNumber > 0 )
{
linekind_comment_aboveline = getFullLindKind_Comment(inDocument,inLineNumber-1);
}
linekind_comment_curline_former = getFullLindKind_Comment(inDocument,inLineNumber);
//begin parsing
struct xmlLexStyleInfo * lexstrptr = 0;
VString xstr;
inDocument->GetLine(inLineNumber,xstr);
const UniChar * unistring = xstr.GetCPointer();
char *lexinput;
sLONG len = xstr.GetLength();
lexinput = new char[len+1];
lexinput[len] = '\0';
for(int i = 0 ; i < len; i++) //to change unicode to char
{
if (unistring[i] == 9)
lexinput[i] = ' ';
else if (unistring[i] > 127)
lexinput[i] = 'X';
else
lexinput[i] = (char)unistring[i];
}
lexstrptr = startxmlParse(lexinput);
linekind_comment_curline_cur = getxmlLinetype();
setLineKind_Lex(inDocument,inLineNumber,linekind_comment_curline_cur);
linekind_comment_curline_cur = linekind_comment_curline_cur%100;
if ( (inDocument->GetLineKind(inLineNumber)%1000)/100 > common ) //if the line tag begin or tagend
{
if ( getLindKind_Tagnameloc(inDocument,inLineNumber) == 0 )
{
allxmltags.Push(getxmlTagName());
setLindKind_Tagnameloc(inDocument,inLineNumber,allxmltags.GetCount());
}
else
{
int line_i_tag_loc = getLindKind_Tagnameloc(inDocument,inLineNumber);
allxmltags[line_i_tag_loc-1] = getxmlTagName();
}
}
inDocument->SetLineStyle(inLineNumber,0,len,0); //initiate the line
for (int j = 0; j < getxmlKeywordNum(); j++ ) //set the keywords color
{
inDocument->SetLineStyle(inLineNumber,lexstrptr->indent,(lexstrptr->indent)+(lexstrptr->length),xmlcolorShadow[lexstrptr->style]);
lexstrptr++;
}
/************************************************************************/
/* the following code to */
/************************************************************************/
for (int commenttypei = 0; commenttypei <= htmlsytlecomment ; commenttypei++ )
{
int linekind_comment_specific_cur = 0;
int linekind_comment_specific_fomer = 0;
int linkkind_comment_specific_above = 0;
if ( commenttypei == ordinarycomment )
{
linekind_comment_specific_cur = linekind_comment_curline_cur%10; //both ..cur and ..former >= 0
//.........这里部分代码省略.........
示例13: DisplayNotification
bool XWinSystem::DisplayNotification( const VString& inTitle, const VString& inMessage, EDisplayNotificationOptions inOptions, ENotificationResponse *outResponse)
{
bool ok;
UINT flags = MB_TASKMODAL | MB_SERVICE_NOTIFICATION;
flags |= (inOptions & EDN_StyleCritical) ? MB_ICONWARNING : MB_ICONINFORMATION;
switch( inOptions & EDN_LayoutMask)
{
case EDN_OK:
flags |= MB_OK;
break;
case EDN_OK_Cancel:
flags |= MB_OKCANCEL;
break;
case EDN_Yes_No:
flags |= MB_YESNO;
break;
case EDN_Yes_No_Cancel:
flags |= MB_YESNOCANCEL;
break;
case EDN_Abort_Retry_Ignore:
flags |= MB_ABORTRETRYIGNORE;
break;
}
switch( inOptions & EDN_DefaultMask)
{
case EDN_Default1:
flags |= MB_DEFBUTTON1;
break;
case EDN_Default2:
flags |= MB_DEFBUTTON2;
break;
case EDN_Default3:
flags |= MB_DEFBUTTON3;
break;
}
if (outResponse == NULL)
{
/*
we need a modeless asynchronous message.
so we create a thread.
*/
// MB_SERVICE_NOTIFICATION est adapte a notre cas (face-less app) mais donne un look Win95 tres moche, et surtout ca serialise les messages !!
VDisplayNotificationParam *param = new VDisplayNotificationParam( inTitle, inMessage, flags, NULL);
DWORD threadID;
HANDLE thread = ::CreateThread( NULL, 0, DisplayNotificationProc, param, 0, &threadID);
ok = (thread != NULL);
if (thread != NULL)
CloseHandle( thread);
}
else
{
int r = ::MessageBoxExW( NULL, inMessage.GetCPointer(), inTitle.GetCPointer(), flags, 0);
ok = r != 0;
switch( r)
{
case IDYES: *outResponse = ERN_Yes; break;
case IDNO: *outResponse = ERN_No; break;
case IDRETRY: *outResponse = ERN_Retry; break;
case IDIGNORE: *outResponse = ERN_Ignore; break;
case IDABORT: *outResponse = ERN_Abort; break;
case IDOK: *outResponse = ERN_OK; break;
case IDCANCEL:
default: *outResponse = ERN_Cancel; break;
}
}
return ok;
}