本文整理汇总了C++中IString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ IString::length方法的具体用法?C++ IString::length怎么用?C++ IString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IString
的用法示例。
在下文中一共展示了IString::length方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyAndSave
//*****************************************************************************
// CLASS GeneralPage :: verifyAndSave() - save database info
//*****************************************************************************
IBase :: Boolean GeneralPage :: verifyAndSave( IString& theString,
IString& theEntry,
const IString theName )
{
/* verify data for correctness */
if ((theName.length() == 0) && (employeeId.text().length() == 0 ))
return true;
// save person information
if ((theName.length() == 0 ) && (theName.isAlphanumeric()))
Key = employeeId.text();
else
Key = theName;
// prime the page from data area
setEmployeeData();
//-------------------------------------------------------------------------
// Save the query
// The key is either what was passed in or the employee number
//-------------------------------------------------------------------------
if (theName.length()>0)
employeeData.save(theName);
else
if ( (!isAquery) &&
(Key.length()> 0 ))
employeeData.save(Key);
return true;
}
示例2: verifyAndSave
/******************************************************************************
* Class AccountPage :: verifyAndSave - Save page information to the database *
******************************************************************************/
bool AccountPage::verifyAndSave( IString& theString,
IString& theEntry,
const IString saveName )
{
/*-----------------------------------------------------------------------------
| If there is no data or is a query, return. |
-----------------------------------------------------------------------------*/
if ( ( ! saveName.length() )
&& ( ! Key.length() )
|| isAquery )
return true;
/*-----------------------------------------------------------------------------
| If able to retrieve the container information, |
| save the information to the database based on the key or query name. |
-----------------------------------------------------------------------------*/
if ( setAcctData() )
{
if ( ( saveName.length() > 0 ) && ( saveName.isAlphanumeric() ) )
acctData.save( saveName );
else
if ( ( Key.length() > 0 ) && ( Key.isAlphanumeric() ) )
acctData.save( Key );
}
return true;
};
示例3: addAcct
/******************************************************************************
* Class AccountPage :: addAcct - Add the account information to the container *
******************************************************************************/
bool AccountPage::addAcct( IString& user, IString& node )
{
bool
rc = true;
/*-----------------------------------------------------------------------------
| Create a container text cursor based on the user ID. |
-----------------------------------------------------------------------------*/
IContainerControl::TextCursor
txtCur( *pCnr, IString( user ), true, false, true );
/*-----------------------------------------------------------------------------
| Start at the beginning of the cursor. |
| If the cursor contains a duplicate, set the return code to false. |
-----------------------------------------------------------------------------*/
for ( txtCur.setToFirst();
txtCur.isValid();
txtCur.setToNext() )
{
if ( ( (AcctCnrObj*) txtCur.current() )->getNode() == node )
{
rc = false;
break;
}
}
/*-----------------------------------------------------------------------------
| If the object doesn't exist, |
| Add the object to the database. |
| Create an account container object. |
| Add the object to the container. |
| Refresh the container. |
-----------------------------------------------------------------------------*/
if ( rc )
{
if ( isAquery )
{
if ( ! user.length() )
user = "*";
if ( ! node.length() )
node = "*";
}
acctData.putItem( user, node, LAcctData::add );
pAcctCnrObj = new AcctCnrObj( user, node );
pCnr->addObject( pAcctCnrObj );
pCnr->refresh();
}
return rc;
}
示例4: compareIt
// -------------------------------------------------------------------------
// QueryInfo Class :: inRange() - match check having a range
// -------------------------------------------------------------------------
IBase :: Boolean QueryInfo :: inRange(const IString &c1
,const IString &c2
,const IString &range)
{
if (c2.length() == 0)
return false;
IString matchItem, compareItem;
matchItem = chopOff(c1);
compareItem = chopOff(c2);
if ( (c1.isDigits()) && (c2.isDigits()) ) {
// compare 2 numbers
long d1=c1.asInt();
long d2=c2.asInt();
return compareIt(d1, d2, range);
}
else {
ADate *date1 = new ADate(c1);
ADate *date2 = new ADate(c2);
return compareIt(date1, date2, range);
} /* endif */
};
示例5: setMovieWindowHandle
void setMovieWindowHandle(IWindowHandle movieWindowHandle)
{
if (movieWindowHandle)
{
IString unqualifiedFileName = movieFrame->quickFlick->fileName();
unsigned long lastDelimiterIndex = unqualifiedFileName.lastIndexOf('\\');
unqualifiedFileName = unqualifiedFileName.subString(lastDelimiterIndex + 1, unqualifiedFileName.length() - lastDelimiterIndex);
movieFrame->title.setObjectText("QuickFlick");
movieFrame->title.setViewText(unqualifiedFileName);
movieFrame->addToWindowList();
movieFrame->movieWindow = IWindow::windowWithHandle(movieWindowHandle);
IDMHandler::enableDropOn(movieFrame->movieWindow);
movieFrame->movieWindow->setItemProvider(movieFrame);
}
if (movieFrame->quickFlick->logoWindowHandle())
{
movieFrame->logo = IWindow::windowWithHandle(movieFrame->quickFlick->logoWindowHandle());
IDMHandler::enableDropOn(movieFrame->logo);
movieFrame->logo->setItemProvider(movieFrame);
}
if (movieWindowHandle && QuickFlick::nonEmbeddedDisplay() == QF_NONEMBED_TOFIT)
movieFrame->reset();
else
movieFrame->showWindow();
}
示例6: enter
/******************************************************************************
* class FontSelectHandler::enter - Handle combo box selections
******************************************************************************/
bool FontSelectHandler::enter( IControlEvent& event)
{
IString fontChoice = ((IComboBox*)event.controlWindow())->text();
if(fontChoice.length())
{
/*----------------------------------------------------------------------------|
| Set the new font |
-----------------------------------------------------------------------------*/
editorFrame.editorFont().setName(fontChoice);
editorFrame.editorWindow().setFont(editorFrame.editorFont());
}
return true;
}
示例7: command
Boolean QFMotionPlayer::command(ICommandEvent &event)
{
IString saveAsFileName;
FOURCC ioProc;
switch (event.commandId())
{
case PLAY_BUTTON_ID:
handlePlayCommand();
return true;
case MI_MOTION_SAVEAS:
saveAsFileName = qf.showSaveAsDialog(window_p);
if (saveAsFileName.length())
{
if (movieWindow)
movieWindow->disable();
if (qf.controller())
qf.controller()->disableControls();
if (isPositionTracking)
{
isPositionTracking = false;
moviePlayer->stopPositionTracking();
moviePlayer->deletePendingEvents(IMMDevice::positionChangeEvent);
}
moviePlayer->stop();
((IMMDigitalVideo*)moviePlayer)->saveAs(saveAsFileName, IMMDevice::wait);
autoStartPerformed = false;
atEnd = true;
if (qf.controller())
qf.controller()->setArmPercent(.0);
prepareThread = new IThread(new IThreadMemberFn<QFMotionPlayer>(*this, QFMotionPlayer::prepare));
}
return true;
default:
return false;
}
}
示例8: ListBoxItem
ListBoxItem :: ListBoxItem ( IDMSourceOperation *srcOp,
IListBox *srcLB,
unsigned index )
: IDMItem( srcOp,
IDM::text,
IDMItem:: moveable | IDMItem::copyable,
none )
{
// Item contents is the list box item text.
this -> setContents( srcLB->itemText( index ) );
// Item object is the item index.
this -> setObject( (void*)index );
// Try to use rfText...
IString
name = this -> generateSourceName(),
rfs = rfForThisProcess();
if ( name.length() )
{ // Text fits, use rfText.
this -> setSourceName( name );
rfs += IString( "," ) + IDM::rfText;
}
else
{ // Text doesn't fit, use rfSharedMem instead.
rfs += IString( "," ) + IDM::rfSharedMem;
this -> setRequiresPreparation();
}
// Set up RMFs; we support dropping on shredder, too.
this -> setRMFs( rmfsFrom( IDM::rmLibrary, rfs ) );
this -> addRMF( IDM::rmDiscard, IDM::rfUnknown );
// Use text icon when dragged.
ISystemPointerHandle
icon( ISystemPointerHandle::text );
IDMImage
image( icon );
this -> setImage( image );
}
示例9: command
/******************************************************************************
* Class AccountPage :: command - Catch and process command events. *
******************************************************************************/
bool AccountPage::command( ICommandEvent& cmdEvent )
{
IString
theUser = userId.text(),
theNode = nodeSys.text();
LAcctData::Rule
theRule = LAcctData::na;
bool
rc = false;
unsigned int
count = 0;
/*-----------------------------------------------------------------------------
| Create a container object cursor based on the selected objects. |
| Process the command events. |
-----------------------------------------------------------------------------*/
IContainerControl::ObjectCursor
soc( *pCnr, IContainerObject::selected );
switch ( cmdEvent.commandId() )
{
/*-----------------------------------------------------------------------------
| User pressed the UNDO button. |
| Reset the account data to the original account data. |
| Reset the container. |
| Reset the entryfields. |
-----------------------------------------------------------------------------*/
case ID_BUTTON_UNDO:
{
acctData = origAcctData;
fillCnr();
userId.setText( "" );
nodeSys.setText( "" );
rc = true;
break;
}
/*-----------------------------------------------------------------------------
| User pressed the REMOVE button. |
| Iterate through the selected objects, |
| remove the object from the the database. |
-----------------------------------------------------------------------------*/
case ID_BUTTON_REMOVE:
{
for ( soc.setToFirst();
soc.isValid();
soc.setToNext() )
{
AcctCnrObj
*pObj = (AcctCnrObj *) soc.current();
acctData.putItem( pObj->getUserId(),
pObj->getNode(),
LAcctData::remove );
++count;
}
/*-----------------------------------------------------------------------------
| If no container objects were selected, |
| notify the user. |
-----------------------------------------------------------------------------*/
if ( ! count )
{
IMessageBox
warning( owner() );
warning.show( STR_MSG_REMOVE,
IMessageBox::enterButton
| IMessageBox::informationIcon );
}
/*-----------------------------------------------------------------------------
| Else remove the selected objects from the container. |
| Refresh the container. |
-----------------------------------------------------------------------------*/
else
{
pCnr->removeSelectedObjects();
userId.setText( "" );
nodeSys.setText( "" );
pCnr->refresh();
}
rc = true;
break;
}
/*-----------------------------------------------------------------------------
| User pressed the CHANGE button. |
| Ignore all but the first selected container object. |
| Update the entryfields with the selected container object information. |
-----------------------------------------------------------------------------*/
case ID_BUTTON_CHANGE:
{
soc.setToFirst();
if ( soc.isValid() )
{
if ( theUser.length() )
{
changeAcct( theUser, theNode, (AcctCnrObj*) soc.current() );
userId.setText( "" );
//.........这里部分代码省略.........
示例10: command
/*------------------------------------------------------------------------------
| ContainerCutPasteHandler::command |
| |
| Handle the command events associated with the clipboard (Cut, Copy, |
| and Paste). |
------------------------------------------------------------------------------*/
bool ContainerCutPasteHandler::command ( ICommandEvent& event)
{
switch(event.commandId())
{
case MI_CUT :
case MI_COPY :
{
// Create a clipboard object.
IClipboard clipboard(event.controlWindow()->handle());
// Find the cursored object in the container.
Department* cursoredObject = (Department*)(container().cursoredObject());
// If a Copy request, utilize delayed rendering to put the data of
// of the private format on the clipboard. If a Cut request, put
// the data directly on the clipboard since the object won't be
// around later when the renderFormat code needs it.
// We maintain an "objectList" collection to keep track of
// the objects copied onto the clipboard so that renderFormat
// knows which objects to render.
// We also store text data for the objects so that applications
// that don't support the private format can paste the data into a
// text editor.
// Clear the collection used to keep track of clipboard objects.
objectList->removeAll();
// If the cursored object is selected, loop through all other
// selected objects and store the objects in our set.
if (container().isSelected(cursoredObject))
{
unsigned long count = 0;
IString objectsAsText("\0");
IContainerControl::ObjectCursor cursor(container(), IContainerObject::selected);
for (cursor.setToFirst(); cursor.isValid(); cursor.setToNext())
{
count++;
Department* selectedObject = (Department*)(container().objectAt(cursor));
objectList->add(selectedObject);
objectsAsText = objectsAsText + selectedObject->text();
}
// Empty the clipboard to establish ownership
clipboard.empty();
// Put the data on the clipboard. We put our private
// format first since it has the most information.
// We use 0 for the data on a Copy request because
// we want to delay the rendering until
// the paste operation.
// If this is a Cut, put the data on the clipboard
// instead of using delayed rendering because we delete
// the object.
if (event.commandId() == MI_CUT)
{
IString string = selectedData();
clipboard.setData(Department::renderedFormat, (const char*)string, string.length()+1);
objectList->removeAll();
container().deleteSelectedObjects();
}
else
clipboard.setData(Department::renderedFormat, 0, 0);
clipboard.setText(objectsAsText);
}
else
{
// If the object is not selected, repeat the above procedure
// for the cursored object.
objectList->add(cursoredObject);
// Empty the clipboard to establish ownership
clipboard.empty();
// Put the data on the clipboard (using
// delayed rendering for a Copy. Delete the object
// if a Cut request.
IString objectAsText = cursoredObject->text();
if (event.commandId() == MI_CUT)
{
IString string = selectedData();
clipboard.setData(Department::renderedFormat, (const char*)string, string.length()+1);
objectList->removeAll();
container().removeObject(cursoredObject);
delete cursoredObject;
}
else
clipboard.setData(Department::renderedFormat, 0,0);
clipboard.setText(objectAsText);
//.........这里部分代码省略.........
示例11: title
Editor::Editor ()
:IFrameWindow(ID_MAIN_WINDOW),
title(this),
flyText(ID_FLYTEXT, &toolBar),
infoText(ID_INFOTEXT, this, this),
flyHelpHandler(&flyText, &infoText, 0, 0),
editWindow(ID_EDITOR, this, this),
toolBar(ID_TOOLBAR, this, IToolBar::aboveClient, false,
IToolBar::classDefaultStyle
| IToolBar::dragDrop),
cutButton (IC_ID_CUT, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::dragDelete ),
copyButton (IC_ID_COPY, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::dragDelete ),
pasteButton (IC_ID_PASTE, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::dragDelete ),
boldButton (IC_ID_BOLD, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::transparentBitmap ),
italicButton (IC_ID_ITALIC, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::transparentBitmap ),
underscoreButton(IC_ID_UNDERSCORE, &toolBar, &toolBar,
IRectangle(), IToolBarButton::defaultStyle() |
IToolBarButton::transparentBitmap ),
fontCombo(ID_FONTCOMBO, &toolBar, &toolBar, IRectangle(),
IBaseComboBox::classDefaultStyle &
~IBaseComboBox::simpleType |
IBaseComboBox::readOnlyDropDownType),
menu(ID_MAIN_WINDOW,this),
fontSelectHandler(*this),
editFont(),
commandhandler(&editFont, &toolBar, &editWindow, &menu)
{
/*----------------------------------------------------------------------------|
| Set the icon and title text |
-----------------------------------------------------------------------------*/
setIcon( id() );
title.setTitleText(ID_MAIN_WINDOW);
/*----------------------------------------------------------------------------|
| Add the buttons to the toolbar |
-----------------------------------------------------------------------------*/
toolBar.addAsLast(&cutButton,true);
toolBar.addAsLast(©Button);
toolBar.addAsLast(&pasteButton);
toolBar.addAsLast(&boldButton,true);
toolBar.addAsLast(&italicButton);
toolBar.addAsLast(&underscoreButton);
toolBar.addAsLast(&fontCombo,true);
/*----------------------------------------------------------------------------|
| Set up latchable style for font property buttons |
| Note: When in bitmapAndTextView, latching a toolbar button will show the |
| gray background for the bitmap. To eliminate the gray background, set |
| the transparent color to gray and turn on the transparent style for the |
| button. If you do not use the bitmapAndTextView and you have many buttons |
| with the latchable style, consider not enabling the transparent style as |
| transparency incurs additional overhead and increases performance time. |
-----------------------------------------------------------------------------*/
boldButton.enableLatching();
italicButton.enableLatching();
underscoreButton.enableLatching();
boldButton.setTransparentColor(IColor::kPaleGray);
italicButton.setTransparentColor(IColor::kPaleGray);
underscoreButton.setTransparentColor(IColor::kPaleGray);
/*----------------------------------------------------------------------------|
| Load up font combo box with face names |
-----------------------------------------------------------------------------*/
fontCombo.setLimit(10);
#ifndef IC_MOTIF
IFont::FaceNameCursor fontCursor;
for ( fontCursor.setToFirst(); fontCursor.isValid(); fontCursor.setToNext())
{
IString faceName = IFont::faceNameAt(fontCursor);
fontCombo.addAsLast(faceName);
if (faceName.length() > fontCombo.limit())
fontCombo.setLimit(faceName.length());
}
#endif
/*----------------------------------------------------------------------------|
| Set up title for toolbar when floating |
-----------------------------------------------------------------------------*/
toolBar.setFloatingTitle(STR_TOOLBAR);
/*----------------------------------------------------------------------------|
| Setup the editor |
-----------------------------------------------------------------------------*/
setClient(&editWindow);
editWindow.setFont(editFont);
try
{
//.........这里部分代码省略.........
示例12: change
void IString::change(IString a, IString b, int i){
int start = this->find(a);
if(start != -1)
this->replace(start, a.length(), b);
}