本文整理汇总了C++中IsText函数的典型用法代码示例。如果您正苦于以下问题:C++ IsText函数的具体用法?C++ IsText怎么用?C++ IsText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PeekWhiteSpace
//-----------------------------------------------------------------------------
// Peek size of sting to come, check memory bound
//-----------------------------------------------------------------------------
int CUtlBufferEditor::PeekStringLength()
{
if ( !IsValid() )
return 0;
// Eat preceeding whitespace
int nOffset = 0;
if ( IsText() )
{
nOffset = PeekWhiteSpace( nOffset );
}
int nStartingOffset = nOffset;
do
{
int nPeekAmount = 128;
// NOTE: Add 1 for the terminating zero!
if ( !CheckArbitraryPeekGet( nOffset, nPeekAmount ) )
{
if ( nOffset == nStartingOffset )
return 0;
return nOffset - nStartingOffset + 1;
}
const char *pTest = (const char *)PeekGet( nOffset );
if ( !IsText() )
{
for ( int i = 0; i < nPeekAmount; ++i )
{
// The +1 here is so we eat the terminating 0
if ( pTest[i] == 0 )
return (i + nOffset - nStartingOffset + 1);
}
}
else
{
for ( int i = 0; i < nPeekAmount; ++i )
{
// The +1 here is so we eat the terminating 0
if ( isspace((unsigned char)pTest[i]) || (pTest[i] == 0) )
return (i + nOffset - nStartingOffset + 1);
}
}
nOffset += nPeekAmount;
} while ( true );
}
示例2: PeekStringLength
//-----------------------------------------------------------------------------
// Reads a null-terminated string
//-----------------------------------------------------------------------------
void CUtlBufferEditor::GetString( char* pString, int nMaxChars )
{
if (!IsValid())
{
*pString = 0;
return;
}
if ( nMaxChars == 0 )
{
nMaxChars = INT_MAX;
}
// Remember, this *includes* the null character
// It will be 0, however, if the buffer is empty.
int nLen = PeekStringLength();
if ( IsText() )
{
EatWhiteSpace();
}
if ( nLen == 0 )
{
*pString = 0;
m_Error |= GET_OVERFLOW;
return;
}
// Strip off the terminating NULL
if ( nLen <= nMaxChars )
{
Get( pString, nLen - 1 );
pString[ nLen - 1 ] = 0;
}
else
{
Get( pString, nMaxChars - 1 );
pString[ nMaxChars - 1 ] = 0;
SeekGet( SEEK_CURRENT, nLen - 1 - nMaxChars );
}
// Read the terminating NULL in binary formats
if ( !IsText() )
{
VerifyEquals( GetChar(), 0 );
}
}
示例3: PutDelimitedString
void CUtlBufferEditor::PutDelimitedString( CUtlCharConversion *pConv, const char *pString )
{
if ( !IsText() || !pConv )
{
PutString( pString );
return;
}
if ( WasLastCharacterCR() )
{
PutTabs();
}
Put( pConv->GetDelimiter(), pConv->GetDelimiterLength() );
int nLen = pString ? Q_strlen( pString ) : 0;
for ( int i = 0; i < nLen; ++i )
{
PutDelimitedCharInternal( pConv, pString[i] );
}
if ( WasLastCharacterCR() )
{
PutTabs();
}
Put( pConv->GetDelimiter(), pConv->GetDelimiterLength() );
}
示例4: if
BOOL CMyBCGPProp::TextToVar(const CString& strText)
{
BOOL bRet = CBCGPProp::TextToVar(strText);
if (bRet)
{
if ((m_dwFlags & PROP_HAS_SPIN) && m_varValue.vt == VT_INT)
{
if (m_varValue.intVal < m_nMinValue)
{
m_varValue.intVal = m_nMinValue;
}
if (m_varValue.intVal > m_nMaxValue)
{
m_varValue.intVal = m_nMaxValue;
}
}
else if (IsText())
{
if (strText.Find('-') != -1)
{
CString strNewText(strText);
strNewText.Replace('-', '_');
m_varValue = (LPCTSTR)strNewText;
}
}
}
return bRet;
}
示例5: nodeInfo
void TSorterListItem::Init()
{
// Set DataType based on entry_ref
BFile theFile;
if ( theFile.SetTo(&m_EntryRef, B_READ_WRITE) == B_OK )
{
// Create node
BNodeInfo nodeInfo(&theFile);
if (nodeInfo.InitCheck() == B_NO_ERROR)
{
if (IsAudio(nodeInfo))
m_DataType = kAudioType;
else if (IsImage(nodeInfo))
m_DataType = kPictureType;
else if (IsText(nodeInfo))
m_DataType = kTextType;
else if (IsVideo(nodeInfo))
m_DataType = kVideoType;
}
else
{
m_DataType = kUnknownType;
}
theFile.Unset();
}
}
示例6: Assert
bool CUtlInplaceBuffer::InplaceGetLinePtr( char **ppszInBufferPtr, int *pnLineLength )
{
Assert( IsText() && !ContainsCRLF() );
int nLineLen = PeekLineLength();
if ( nLineLen <= 1 )
{
SeekGet( SEEK_TAIL, 0 );
return false;
}
-- nLineLen; // because it accounts for putting a terminating null-character
char *pszLine = ( char * ) const_cast< void * >( PeekGet() );
SeekGet( SEEK_CURRENT, nLineLen );
// Set the out args
if ( ppszInBufferPtr )
*ppszInBufferPtr = pszLine;
if ( pnLineLength )
*pnLineLength = nLineLen;
return true;
}
示例7: do_QueryInterface
PRBool
nsAccUtils::IsTextInterfaceSupportCorrect(nsIAccessible *aAccessible)
{
PRBool foundText = PR_FALSE;
nsCOMPtr<nsIAccessibleDocument> accDoc = do_QueryInterface(aAccessible);
if (accDoc) {
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
return PR_TRUE;
}
nsCOMPtr<nsIAccessible> child, nextSibling;
aAccessible->GetFirstChild(getter_AddRefs(child));
while (child) {
if (IsText(child)) {
foundText = PR_TRUE;
break;
}
child->GetNextSibling(getter_AddRefs(nextSibling));
child.swap(nextSibling);
}
if (foundText) {
// found text child node
nsCOMPtr<nsIAccessibleText> text = do_QueryInterface(aAccessible);
if (!text)
return PR_FALSE;
}
return PR_TRUE;
}
示例8: NS_SUCCEEDED
PRInt32
nsAccUtils::TextLength(nsIAccessible *aAccessible)
{
if (!IsText(aAccessible))
return 1;
nsRefPtr<nsAccessNode> accNode = nsAccUtils::QueryAccessNode(aAccessible);
nsIFrame *frame = accNode->GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::textFrame) {
// Ensure that correct text length is calculated (with non-rendered
// whitespace chars not counted).
nsIContent *content = frame->GetContent();
if (content) {
PRUint32 length;
nsresult rv = nsHyperTextAccessible::
ContentToRenderedOffset(frame, content->TextLength(), &length);
return NS_SUCCEEDED(rv) ? static_cast<PRInt32>(length) : -1;
}
}
// For list bullets (or anything other accessible which would compute its own
// text. They don't have their own frame.
// XXX In the future, list bullets may have frame and anon content, so
// we should be able to remove this at that point
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(aAccessible));
nsAutoString text;
acc->AppendTextTo(text, 0, PR_UINT32_MAX); // Get all the text
return text.Length();
}
示例9: do_QueryObject
PRBool
nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
{
PRBool foundText = PR_FALSE;
nsCOMPtr<nsIAccessibleDocument> accDoc = do_QueryObject(aAccessible);
if (accDoc) {
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
return PR_TRUE;
}
PRInt32 childCount = aAccessible->GetChildCount();
for (PRint32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);
if (IsText(child)) {
foundText = PR_TRUE;
break;
}
}
if (foundText) {
// found text child node
nsCOMPtr<nsIAccessibleText> text = do_QueryObject(aAccessible);
if (!text)
return PR_FALSE;
}
return PR_TRUE;
}
示例10: PutDelimitedChar
void CUtlBufferEditor::PutDelimitedChar( CUtlCharConversion *pConv, char c )
{
if ( !IsText() || !pConv )
{
PutChar( c );
return;
}
PutDelimitedCharInternal( pConv, c );
}
示例11: CrashIf
// reparse point is an address within html that we can
// can feed to HtmlPullParser() to start parsing from that point
const char *HtmlToken::GetReparsePoint() const
{
if (IsStartTag() || IsEmptyElementEndTag())
return s - 1;
if (IsEndTag())
return s - 2;
if (IsText())
return s;
CrashIf(true); // don't call us on error tokens
return NULL;
}
示例12: OnClickButton
void CMyBCGPProp::OnClickButton(CPoint point)
{
CBCGPProp::OnClickButton(point);
if (IsText())
{
ASSERT_VALID(this);
ASSERT_VALID(m_pWndList);
ASSERT_VALID(m_pWndInPlace);
ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd()));
m_bButtonIsDown = TRUE;
m_bButtonIsHighlighted = FALSE;
Redraw();
CString strPath = (LPCTSTR)(_bstr_t)m_varValue;
BOOL bUpdate = FALSE;
CMulTextEditDlg dlg;
dlg.SetText(strPath);
if (dlg.DoModal() == IDOK)
{
bUpdate = TRUE;
strPath = dlg.GetText();
}
if (bUpdate)
{
if (strPath.Find('-') != -1)
{
strPath.Replace('-', '_');
}
if (m_pWndInPlace != NULL)
{
m_pWndInPlace->SetWindowText(strPath);
}
m_varValue = (LPCTSTR)strPath;
}
m_bButtonIsDown = FALSE;
Redraw();
if (m_pWndInPlace != NULL)
{
m_pWndInPlace->SetFocus();
}
else
{
m_pWndList->SetFocus();
}
}
}
示例13: EatWhiteSpace
//-----------------------------------------------------------------------------
// Eats whitespace
//-----------------------------------------------------------------------------
void CUtlBufferEditor::EatWhiteSpace()
{
if ( IsText() && IsValid() )
{
while ( CheckGet( sizeof(char) ) )
{
if ( !isspace( *(const unsigned char*)PeekGet() ) )
break;
m_Get += sizeof(char);
}
}
}
示例14: PutString
//-----------------------------------------------------------------------------
// Writes a null-terminated string
//-----------------------------------------------------------------------------
void CUtlBufferEditor::PutString( const char* pString )
{
if (!IsText())
{
if ( pString )
{
// Not text? append a null at the end.
size_t nLen = Q_strlen( pString ) + 1;
Put( pString, nLen * sizeof(char) );
return;
}
else
{
PutTypeBin<char>( 0 );
}
}
else if (pString)
{
int nTabCount = ( m_Flags & AUTO_TABS_DISABLED ) ? 0 : m_nTab;
if ( nTabCount > 0 )
{
if ( WasLastCharacterCR() )
{
if ( !IsDirectiveLine( pString ) )
PutTabs();
}
const char* pEndl = strchr( pString, '\n' );
while ( pEndl )
{
size_t nSize = (size_t)pEndl - (size_t)pString + sizeof(char);
Put( pString, nSize );
pString = pEndl + 1;
if ( *pString )
{
if ( !IsDirectiveLine( pString ) )
PutTabs();
pEndl = strchr( pString, '\n' );
}
else
{
pEndl = NULL;
}
}
}
size_t nLen = Q_strlen( pString );
if ( nLen )
{
Put( pString, nLen * sizeof(char) );
}
}
}
示例15: GetDelimitedString
void CUtlBufferEditor::GetDelimitedString( CUtlCharConversion *pConv, char *pString, int nMaxChars )
{
if ( !IsText() || !pConv )
{
GetString( pString, nMaxChars );
return;
}
if (!IsValid())
{
*pString = 0;
return;
}
if ( nMaxChars == 0 )
{
nMaxChars = INT_MAX;
}
EatWhiteSpace();
if ( !PeekStringMatch( 0, pConv->GetDelimiter(), pConv->GetDelimiterLength() ) )
return;
// Pull off the starting delimiter
SeekGet( SEEK_CURRENT, pConv->GetDelimiterLength() );
int nRead = 0;
while ( IsValid() )
{
if ( PeekStringMatch( 0, pConv->GetDelimiter(), pConv->GetDelimiterLength() ) )
{
SeekGet( SEEK_CURRENT, pConv->GetDelimiterLength() );
break;
}
char c = GetDelimitedCharInternal( pConv );
if ( nRead < nMaxChars )
{
pString[nRead] = c;
++nRead;
}
}
if ( nRead >= nMaxChars )
{
nRead = nMaxChars - 1;
}
pString[nRead] = '\0';
}