int32 CEditCombinationProp::GetProp( EFFECT_PROP* pProp, int32 nBufLen ) { EVector<EFFECT_PROP> Prop; CEditUnitPropHelp::GetBaseProp( Prop ); EString effectNameList = "None"; if( m_pEffectGroup ) { uint32 nEffectNum = m_pEffectGroup->GetEffectNum(); for ( uint32 i = 0; i < nEffectNum; ++i ) { effectNameList += ","; EString strEffectName = m_pEffectGroup->GetEffectName(i); effectNameList += strEffectName; } } if( effectNameList.size() > 120 ) effectNameList[120] = 0; Prop.push_back( EFFECT_PROP( "特效文件", sqr::CStringData( 3, m_strEffectFileName ) ) ); Prop.push_back( EFFECT_PROP( "特效名", CComboData( (BYTE)m_nEffectIndex, effectNameList .c_str() ) ) ); nBufLen = min( nBufLen,(int32) Prop.size() ); for ( int32 i = 0; i < nBufLen; ++i )pProp[i] = Prop[i]; return nBufLen; }
/* * Discovery callback */ static void discovery_cb(struct iscsi_context *iscsi, int status, void *command_data, void *private_data) { iSCSILibWrapper *obj = (iSCSILibWrapper *)private_data; struct wrapper_client_state *client = obj->GetClientState(); struct iscsi_discovery_address *addr; if (status) { EString error; error.Format("%s: Failed to perform discovery: %s", __func__, iscsi_get_error(iscsi)); client->error_message = strdup(error.c_str()); client->finished = 1; client->error = 1; return; } for (addr = (struct iscsi_discovery_address *)command_data; addr; addr = addr->next) { // Add them to the object that called us obj->AddDiscoveryPair(addr->target_name, addr->target_address); } client->finished = 1; }
EString ImapParser::quoted() { EString r; char c = nextChar(); if ( c != '"' ) { setError( "Expected quoted string, but saw: " + following() ); return r; } step(); c = nextChar(); while ( c != '"' && c < 128 && c > 0 && c != 10 && c != 13 ) { if ( c == '\\' ) { step(); c = nextChar(); if ( c == 0 || c >= 128 || c == 10 || c == 13 ) setError( "Quoted string contained bad char: " + following() ); } step(); r.append( c ); c = nextChar(); } if ( c != '"' ) setError( "Quoted string incorrectly terminated: " + following() ); else step(); return r; }
EString ImapParser::quoted() { EString r; char c = nextChar(); if ( c != '"' ) { setError( "Expected quoted string, but saw: " + following() ); return r; } step(); c = nextChar(); while ( c != '"' && c > 0 && c != 10 && c != 13 ) { if ( c == '\\' ) { step(); c = nextChar(); if ( c == 0 || c == 10 || c == 13 ) setError( "Quoted string contained bad char: " + following() ); } step(); r.append( c ); c = nextChar(); } if ( c != '"' ) setError( "Quoted string incorrectly terminated: " + following() ); else step(); Utf8Codec utf8; UString u( utf8.toUnicode( r ) ); return utf8.fromUnicode( u ); }
bool ManageSieveCommand::listScripts() { if ( !d->query ) { end(); d->query = new Query( "select * from scripts where owner=$1 order by name", this ); d->query->bind( 1, d->sieve->user()->id() ); if ( d->no.isEmpty() ) d->query->execute(); } while ( d->query->hasResults() ) { Row * r = d->query->nextRow(); EString line = encoded( r->getEString( "name" ) ); if ( r->getBoolean( "active" ) ) line.append( " ACTIVE" ); d->sieve->send( line ); } if ( !d->query->done() ) return false; return true; }
void Multipart::appendAnyPart( EString &r, const Bodypart * bp, ContentType * ct, bool avoidUtf8 ) const { ContentType * childct = bp->header()->contentType(); EString::Encoding e = EString::Binary; ContentTransferEncoding * cte = bp->header()->contentTransferEncoding(); if ( cte ) e = cte->encoding(); if ( ( childct && childct->type() == "message" ) || ( ct && ct->type() == "multipart" && ct->subtype() == "digest" && !childct ) ) { if ( childct && childct->subtype() != "rfc822" ) appendTextPart( r, bp, childct ); else r.append( bp->message()->rfc822( avoidUtf8 ) ); } else if ( !childct || childct->type().lower() == "text" ) { appendTextPart( r, bp, childct ); } else if ( childct->type() == "multipart" ) { bp->appendMultipart( r, avoidUtf8 ); } else { r.append( bp->data().encoded( e, 72 ) ); } }
Deliverator( Injectee * message, const UString & mailbox, const EString & user ) : q( 0 ), i( 0 ), m( message ), mbn( mailbox ), un( user ), p( 0 ), mb( 0 ) { Allocator::addEternal( this, "deliver object" ); q = new Query( "select al.mailbox, n.name as namespace, u.login " "from aliases al " "join addresses a on (al.address=a.id) " "left join users u on (al.id=u.alias) " "left join namespaces n on (u.parentspace=n.id) " "where (lower(a.localpart)=$1 and lower(a.domain)=$2) " "or (lower(u.login)=$3)", this ); if ( user.contains( '@' ) ) { int at = user.find( '@' ); q->bind( 1, user.mid( 0, at ).lower() ); q->bind( 2, user.mid( at + 1 ).lower() ); } else { q->bindNull( 1 ); q->bindNull( 2 ); } q->bind( 3, user.lower() ); q->execute(); }
EString SmtpParser::atom() { char c = nextChar(); EString r; while ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '!' || c == '#' || c == '$' || c == '%' || c == '&' || c == '\'' || c == '*' || c == '+' || c == '-' || c == '/' || c == '=' || c == '?' || c == '^' || c == '_' || c == '`' || c == '{' || c == '|' || c == '}' || c == '~' ) { r.append( c ); step(); c = nextChar(); } if ( r.isEmpty() ) setError( "Expected atom, saw: " + following() ); return r; }
EString Message::partNumber( Bodypart * bp ) const { Multipart * m = bp; EString r; while ( m && m->isBodypart() ) { if ( !r.isEmpty() ) r = "." + r; Multipart * parent = m->parent(); List<Bodypart>::Iterator i; if ( parent ) i = parent->children()->first(); else i = children()->first(); uint n = 1; while ( i && i != m ) { ++i; ++n; } if ( !i ) return ""; r = fn( n ) + r; m = parent; } return r; }
void MPHostGame::update() { if ( bShowDlg ) { LogisticsOneButtonDialog::instance()->update(); if ( LogisticsOneButtonDialog::instance()->isDone() ) { bShowDlg = 0; status = NO; } return; } LogisticsDialog::update(); helpTextID = 0; helpTextHeaderID = 0; EString tmp; edits[0].getEntry(tmp); long len = tmp.Length(); if ( len >= 1) { getButton( YES )->disable( false ); } else getButton( YES )->disable( true ); }
EStringList * SieveProduction::supportedExtensions() { EStringList * r = new EStringList; // sorted by name, please r->append( "body" ); EStringList::Iterator c( Collation::supported() ); while ( c ) { EString name = "comparator-"; name.append( *c ); r->append( name ); ++c; } r->append( "copy" ); r->append( "date" ); r->append( "ereject" ); r->append( "envelope" ); r->append( "fileinto" ); r->append( "ihave" ); r->append( "imap4flags" ); r->append( "reject" ); r->append( "relational" ); r->append( "subaddress" ); r->append( "vacation" ); return r; }
void Database::setup( uint desired, const EString & user, const EString & pass ) { if ( !queries ) { queries = new List< Query >; Allocator::addEternal( queries, "list of queries" ); } if ( !handles ) { handles = new List< Database >; Allocator::addEternal( handles, "list of database handles" ); } if ( ::username ) Allocator::removeEternal( ::username ); ::username = new EString( user ); Allocator::addEternal( ::username, "database username" ); if ( ::password ) Allocator::removeEternal( ::password ); ::password = new EString( pass ); Allocator::addEternal( ::password, "database password" ); EString db = Configuration::text( Configuration::Db ).lower(); EString dbt = db.section( "+", 1 ); if ( dbt != "pg" && dbt != "pgsql" && dbt != "postgres" ) { ::log( "Unsupported database type: " + db, Log::Disaster ); return; } addInitialHandles( desired ); }
void CEditUnitPropHelp::SetBaseProp( const EVector< EFFECT_PROP >& Prop ) { EString str; for( size_t i = 0; i < Prop.size(); ++i ) { if( Prop[i].Name() == "跟随加速" ) m_pEffectUnitProp->m_isUseVel =Prop[i].Data().Bool(); if( Prop[i].Name() == "连接点" ) m_pEffectUnitProp->m_eUpdatePos = (eUpdatePosType)Prop[i].Data().Index(); if( Prop[i].Name() == "连接对象名字" ) m_pEffectUnitProp->m_szAttachName = Prop[i].Data().Str(); if( Prop[i].Name() == "关联的动画" ) str = Prop[i].Data().Str(); if( Prop[i].Name() == "自定义类名" ) m_pEffectUnitProp->m_EffectClassName = Prop[i].Data().Str(); if( Prop[i].Name() == "贴图重复次数" ) m_pEffectUnitProp->m_nTextureCircle = max( 1, Prop[i].Data().Int() ); if( Prop[i].Name() == "缓慢消失" ) m_pEffectUnitProp->m_bSlownDisappear =Prop[i].Data().Bool(); } m_pEffectUnitProp->m_szAniName.clear(); char* pStr = (char*)str.c_str(); for( int32 i = strlen( pStr) - 1; i > 0; --i ) { if( pStr[i] == ',' ) { pStr[i] = 0; EString Temp = pStr + i + 1; if( !Temp.empty() ) m_pEffectUnitProp->m_szAniName.insert( Temp ); } } m_pEffectUnitProp->m_szAniName.insert( pStr ); }
UString SmtpParser::atom() { char c = nextChar(); EString r; while ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '!' || c == '#' || c == '$' || c == '%' || c == '&' || c == '\'' || c == '*' || c == '+' || c == '-' || c == '/' || c == '=' || c == '?' || c == '^' || c == '_' || c == '`' || c == '{' || c == '|' || c == '}' || c == '~' || c >= 128 ) { r.append( c ); step(); c = nextChar(); } if ( r.isEmpty() ) setError( "Expected atom, saw: " + following() ); Utf8Codec uc; UString u = uc.toUnicode( r ); if ( !uc.valid() ) setError( "Unicode error in atom (" + uc.error() + "): " + r ); return u; }
EString ImapUrlParser::xchars( bool b ) { EString s; char c = nextChar(); while ( c != '\0' ) { if ( unreserved( c ) || ( c == '&' || c == '=' || c == '~' ) || ( b && ( c == ':' || c == '@' || c == '/' ) ) ) { // Nasty hack: we won't eat the beginning of "/;UID". if ( b && c == '/' && str[pos()+1] == ';' ) break; s.append( c ); step(); } else if ( c == '%' && escape( &c ) ) { s.append( c ); } else { break; } c = nextChar(); } return s; }
static void server() { ENetEndpoint endpoint(SOCK_STREAM); if(endpoint.InitCheck() != E_OK) ETK_ERROR("Failed to create endpoint: %s.", endpoint.ErrorStr()); if(endpoint.Bind(DEFAULT_PORT) != E_OK) ETK_ERROR("Bind(%d) failed: %s.", DEFAULT_PORT, endpoint.ErrorStr()); if(endpoint.Listen() != E_OK) ETK_ERROR("Listen() failed: %s.", endpoint.ErrorStr()); while(true) { ETK_OUTPUT("Waiting for client ...\n"); ENetEndpoint *connection = endpoint.Accept(500); if(connection == NULL) { ETK_WARNING("Accept() == NULL: %s.", endpoint.ErrorStr()); continue; } struct in_addr addr; euint16 port; connection->RemoteAddr().GetAddr(addr, &port); euint32 ip = E_BENDIAN_TO_HOST_INT32(addr.s_addr); ETK_OUTPUT("connection from %d.%d.%d.%d, port: %d\n", ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, port); EString buf; time_t curTime = time(NULL); buf << ctime(&curTime) << "\r\n"; connection->Send(buf.String(), buf.Length()); delete connection; } }
EString Configuration::osHostname() { char buffer[257]; gethostname( buffer, 256 ); buffer[256] = '\0'; EString host( buffer ); if ( host.find( '.' ) < 0 ) { struct hostent * he = gethostbyname( buffer ); if ( he ) { EString candidate = he->h_name; int i = 0; bool done = false; do { uint hl = host.length(); if ( candidate[hl] == '.' && candidate.mid( 0, hl ).lower() == host.lower() ) { host = candidate; done = true; } candidate = he->h_aliases[i]; i++; } while ( !done && !candidate.isEmpty() ); } } return host; }
void RecorderClient::react( Event e ) { EString tmp; switch( e ) { case Read: tmp = readBuffer()->string( readBuffer()->size() ); d->toClient.append( tmp ); d->server->enqueue( tmp ); readBuffer()->remove( tmp.length() ); if ( d->toClient.find( '\n' ) ) d->dump( RecorderData::ToServer ); break; case Close: d->dump( RecorderData::ToServer ); d->dump( RecorderData::ToClient ); d->assertEmpty(); d->server->close(); delete d->log; d->log = 0; break; default: { // an error of some sort } break; } }
EString EHttpProxyRequest::toHttpString() { EString sb; sb.append(getHttpVerb()).append(' ').append(getHttpURI()).append(' ').append(getHttpVersion()) .append(EHttpProxyConstants_CRLF); boolean hostHeaderFound = false; if (getHeaders() != null) { sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = getHeaders()->entrySet()->iterator(); while (iter->hasNext()) { EMapEntry<EString*, EList<EString*>*>* header = iter->next(); if (!hostHeaderFound) { hostHeaderFound = header->getKey()->equalsIgnoreCase("host"); } EList<EString*>* values = header->getValue(); if (values) { sp<EIterator<EString*> > iter2 = values->iterator(); while (iter2->hasNext()) { sb.append(header->getKey()->c_str()).append(": ").append(iter2->next()).append(EHttpProxyConstants_CRLF); } } } if (!hostHeaderFound && (eso_strcmp(getHttpVersion(), EHttpProxyConstants_HTTP_1_1) == 0)) { sb.append("Host: ").append(getHost()).append(EHttpProxyConstants_CRLF); } } sb.append(EHttpProxyConstants_CRLF); return sb; }
void SessionInitialiser::findMailboxChanges() { bool initialising = false; if ( d->oldUidnext <= 1 ) initialising = true; EString msgs = "select mm.uid, mm.modseq from mailbox_messages mm " "where mm.mailbox=$1 and mm.uid<$2"; // if we know we'll see one new modseq and at least one new // message, we could skip the test on mm.modseq. if ( !initialising ) msgs.append( " and (mm.uid>=$3 or mm.modseq>=$4)" ); d->messages = new Query( msgs, this ); d->messages->bind( 1, d->mailbox->id() ); d->messages->bind( 2, d->newUidnext ); if ( !initialising ) { d->messages->bind( 3, d->oldUidnext ); d->messages->bind( 4, d->oldModSeq ); } submit( d->messages ); if ( initialising ) return; d->expunges = new Query( "select uid from deleted_messages " "where mailbox=$1 and modseq>=$2", this ); d->expunges->bind( 1, d->mailbox->id() ); d->expunges->bind( 2, d->oldModSeq ); submit( d->expunges ); }
void iSCSIBackGround::RemoveConnection(iSCSILibWrapper &iscsi) { unsigned int index = mConnections.size(); boost::mutex::scoped_lock lock(mWorkMutex); // Take the lock ... // Now find and remove the object of interest for (unsigned int i = 0; i < mConnections.size(); i++) { if (mConnections[i] == &iscsi) { index = i; break; } } if (index < mConnections.size()) { mConnections.erase(mConnections.begin() + index); // Remove it mWorkCond.notify_one(); // Perhaps we should unlock first } else { EString errorStr; errorStr.Format("%s: No such item in vector: %s", __func__, strerror(errno)); throw CException(errorStr); } }
void Configuration::setup( const EString & global, bool allowFailure ) { d = new ConfigurationData; Allocator::addEternal( d, "configuration data" ); if ( global.isEmpty() ) return; else if ( global[0] == '/' ) read( global, allowFailure ); else read( EString( compiledIn( ConfigDir ) ) + "/" + global, allowFailure ); EString hn = text( Hostname ); if ( hn.find( '.' ) < 0 ) log( "Hostname does not contain a dot: " + hn, Log::Error ); if ( hn.lower() == "localhost" || hn.lower().startsWith( "localhost." ) ) log( "Using localhost as hostname", Log::Error ); if ( !present( UseIPv6 ) && toggle( UseIPv6 ) ) { int s = ::socket( PF_INET6, SOCK_STREAM, IPPROTO_TCP ); bool bad = false; bool good = false; if ( s < 0 ) { bad = true; } if ( !bad ) { struct sockaddr_in6 in6; in6.sin6_family = AF_INET6; in6.sin6_port = ntohs( 17 ); // stomping on fortune is okay in6.sin6_flowinfo = 0; int i = 0; while ( i < 15 ) { in6.sin6_addr.s6_addr[i] = 0; ++i; } in6.sin6_addr.s6_addr[15] = ntohs( 1 ); in6.sin6_scope_id = 0; if ( ::bind( s, (struct sockaddr *)&in6, sizeof( in6 ) ) < 0 ) { if ( errno == EADDRINUSE ) good = true; // someone is using that: fine else bad = true; // some other error: IPv6 presumably broken } } if ( !good && !bad && s >= 0 ) { if ( ::listen( s, 1 ) < 0 ) bad = true; else good = true; } if ( s >= 0 ) ::close( s ); if ( bad ) { log( "Setting default use-ipv6=off", Log::Info ); add( "use-ipv6 = false" ); } } }
Header * Message::parseHeader( uint & i, uint end, const EString & rfc2822, Header::Mode m ) { Header * h = new Header( m ); bool done = false; while ( !done ) { if ( i >= end ) done = true; if ( rfc2822[i] == 0xEF && rfc2822[i+1] == 0xBB && rfc2822[i+2] == 0xBF ) i += 3; uint j = i; while ( rfc2822[j] >= 33 && rfc2822[j] <= 127 && rfc2822[j] != ':' ) j++; if ( j == i + 4 && m == Header::Rfc2822 && rfc2822.mid( i, j-i+1 ).lower() == "from " ) { while ( i < end && rfc2822[i] != '\r' && rfc2822[i] != '\n' ) i++; while ( rfc2822[i] == '\r' ) i++; if ( rfc2822[i] == '\n' ) i++; } else if ( j > i && rfc2822[j] == ':' ) { EString name = rfc2822.mid( i, j-i ); i = j; i++; while ( rfc2822[i] == ' ' || rfc2822[i] == '\t' ) i++; j = i; // this isn't at all pretty, is it... while ( j < rfc2822.length() && ( rfc2822[j] != '\n' || ( rfc2822[j] == '\n' && ( rfc2822[j+1] == ' ' || rfc2822[j+1] == '\t' ) ) ) ) j++; if ( j && rfc2822[j-1] == '\r' ) j--; EString value = rfc2822.mid( i, j-i ); if ( !value.simplified().isEmpty() || name.lower().startsWith( "x-" ) ) { HeaderField * f = HeaderField::create( name, value ); h->add( f ); } i = j; if ( rfc2822[i] == '\r' && rfc2822[i+1] == '\n' ) i++; i++; } else { done = true; } } return h; }
inline e_status_t convert_to_docbook(ESimpleXmlNode *node, EString *buffer, const char *options, const char *lang) { if(node == NULL || buffer == NULL || lang == NULL || strlen(lang) == 0) return E_ERROR; ESimpleXmlNode *aNode = node->NodeAt(node->FindNode("documentinfo")); if(options == NULL) options = "article"; buffer->MakeEmpty(); buffer->Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); if(strcmp(options, "book") == 0 || strcmp(options, "article") == 0) { buffer->AppendFormat("<!DOCTYPE %s PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"\n", options); buffer->Append("\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">\n"); // buffer->Append("[\n]>\n\n"); if(aNode) { EString str; str << options << "info"; aNode->SetName(str.String()); aNode->RemoveSelf(); } } else if(aNode) { ESimpleXmlNode *cNode = aNode->NodeAt(aNode->FindNode("title")); if(cNode) cNode->RemoveSelf(); aNode->RemoveSelf(); delete aNode; aNode = cNode; } buffer->Append("<!-- ***** This is a generated file by \"etkxx-doc\", please modify the sources. ***** -->\n"); buffer->AppendFormat("<%s lang=\"%s\">", options, lang); if(aNode) { convert_document_to_docbook(aNode, buffer); delete aNode; aNode = NULL; } eint32 offset = 0; while(offset >= 0 && offset < node->CountNodes()) { if((offset = node->FindNode("document", offset)) < 0) break; if((aNode = node->NodeAt(offset)) == NULL) break; offset++; buffer->Append("\n"); convert_document_to_docbook(aNode, buffer); } buffer->AppendFormat("\n</%s>\n\n", options); return E_OK; }
ERollingFileAppender::ERollingFileAppender(EConfiguration* conf, EConfig* props, EString& prefix, ELogger::Level threshold) : EFileAppender(conf, props, prefix, threshold) { EString maxFileSizePrefix = prefix + ".MaxFileSize"; maxFileSize_ = EOptionConverter::toFileSize(props->getString(maxFileSizePrefix.c_str()), 10*1024*1024L); EString maxBackupIndexPrefix = prefix + ".MaxBackupIndex"; maxBackupIndex_ = props->getInteger(maxBackupIndexPrefix.c_str(), 1); }
long MechListBox::AddItem(aListItem* itemString) { itemString->setID( ID ); MechListBoxItem* pItem = dynamic_cast<MechListBoxItem*>(itemString); EString addedName; char tmp[256]; cLoadString( pItem->getMech()->getChassisName(), tmp, 255 ); addedName = tmp; if ( pItem ) { pItem->bOrange = bOrange; pItem->bIncludeForceGroup = bIncludeForceGroup; if ( !bDeleteIfNoInventory ) { pItem->countText.setColor( 0 ); pItem->countText.showGUIWindow( 0 ); } EString chassisName; for ( int i = 0; i < itemCount; i++ ) { long ID = ((MechListBoxItem*)items[i])->pMech->getChassisName(); char tmpChassisName[256]; cLoadString( ID, tmpChassisName, 255 ); chassisName = tmpChassisName; if ( ((MechListBoxItem*)items[i])->pMech->getMaxWeight() < pItem->pMech->getMaxWeight() ) { return InsertItem( itemString, i ); break; } else if ( ((MechListBoxItem*)items[i])->pMech->getMaxWeight() == pItem->pMech->getMaxWeight() && chassisName.Compare( addedName ) > 0 ) { return InsertItem( itemString, i ); } else if ( ((MechListBoxItem*)items[i])->pMech->getMaxWeight() == pItem->pMech->getMaxWeight() && chassisName.Compare( addedName ) == 0 && ((MechListBoxItem*)itemString)->pMech->getName().Find("Prime") != -1 ) { return InsertItem( itemString, i ); } else if ( ((MechListBoxItem*)items[i])->pMech->getMaxWeight() == pItem->pMech->getMaxWeight() && chassisName.Compare( addedName ) == 0 && ( ((MechListBoxItem*)items[i])->pMech->getName().Find("Prime" ) == -1 ) && ((MechListBoxItem*)items[i])->pMech->getName().Compare( pItem->pMech->getName() ) > 0 ) { return InsertItem( itemString, i ); } } } return aListBox::AddItem( itemString ); }
EString UString::utf8() const { EString s; Utf8Codec u; s = u.fromUnicode( *this ); s.append( (char)0 ); s.truncate( s.length() - 1 ); return s; }
BOOL ChooseBuildingDlg::OnInitDialog() { m_pComboBox = (CComboBox *)GetDlgItem(IDC_CHOOSE_BUILDING_COMBO); assert( m_pComboBox ); m_pUsingPointerButton = (CButton *)GetDlgItem(IDC_CHOOSE_BUILDING_USING_POINTER_BUTTON); assert( m_pUsingPointerButton ); m_pCancelButton = (CButton *)GetDlgItem(IDCANCEL); assert( m_pCancelButton ); m_pOKButton = (CButton *)GetDlgItem(IDOK); assert( m_pOKButton ); if (EditorInterface::instance()->ObjectSelectOnlyMode()) { m_pModifiedBuildingPtr = (building_ptr_type *)EditorInterface::instance()->objectivesEditState.pModifiedBuildingPtr; } else { m_pModifiedBuildingPtr = new building_ptr_type; (*m_pModifiedBuildingPtr) = (*m_pBuildingPtr); } m_buildingList.Clear(); EditorObjectMgr::BUILDING_LIST completeBuildingList = EditorObjectMgr::instance()->getBuildings(); EditorObjectMgr::BUILDING_LIST::EConstIterator it2 = completeBuildingList.Begin(); while (!it2.IsDone()) { //if ((BUILDING == typeNum) || (TREEBUILDING == typeNum)) { if (true) { m_buildingList.Append(*it2); } it2++; } EditorObjectMgr::BUILDING_LIST::EConstIterator it = m_buildingList.Begin(); while (!it.IsDone()) { EString tmpEStr; Stuff::Vector3D pos = (*it)->getPosition(); const char *szDisplayName = (*it)->getDisplayName(); // nb: localization assert(szDisplayName); tmpEStr.Format("(pos: %.3f, %.3f) %s", pos.x, pos.y, szDisplayName); m_pComboBox->AddString(tmpEStr.Data()); it++; } if (1 <= m_buildingList.Count()) { m_pComboBox->SetCurSel(0); } else { AfxMessageBox(IDS_NO_STRUCTURES); OnCancel(); } if (EditorInterface::instance()->ObjectSelectOnlyMode()) { // post a message that the USEPOINTER button was pressed PostMessage(WM_COMMAND, (WPARAM)BN_CLICKED, (LPARAM)m_pUsingPointerButton->m_hWnd); } return 1; }
bool PopCommand::list() { ::Session * s = d->pop->session(); if ( !d->started ) { d->started = true; if ( d->args->count() == 0 ) { uint n = s->count(); while ( n >= 1 ) { d->set.add( s->uid( n ) ); n--; } } else { bool ok; EString arg = *d->args->first(); uint msn = arg.number( &ok ); if ( !ok || msn < 1 || msn > s->count() ) { d->pop->err( "Bad message number" ); return true; } d->set.add( s->uid( msn ) ); } log( "LIST command (" + d->set.set() + ")" ); } if ( !fetch822Size() ) return false; if ( d->args->count() == 1 ) { uint uid = d->set.smallest(); Message * m = d->pop->message( uid ); if ( m ) d->pop->ok( fn( s->msn( uid ) ) + " " + fn( m->rfc822Size() ) ); else d->pop->err( "No such message" ); } else { uint i = 1; d->pop->ok( "Done" ); while ( i <= d->set.count() ) { uint uid = d->set.value( i ); Message * m = d->pop->message( uid ); if ( m ) d->pop->enqueue( fn( s->msn( uid ) ) + " " + fn( m->rfc822Size() ) + "\r\n" ); i++; } d->pop->enqueue( ".\r\n" ); } return true; }
EString Parser::type() { uint j = type( i ); EString r = t.mid( i, j-i ).simplified(); // simplified() is not quite right i = j; while ( r.startsWith( "class " ) ) r = r.mid( 6 ); r.replace( " class ", " " ); return r; }