void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSPropertyID unresolvedProperty, bool important, StyleRule::Type ruleType) { bool usesRemUnits; CSSParserValueList valueList(range, usesRemUnits); if (!valueList.size()) return; // Parser error if (usesRemUnits && m_styleSheet) m_styleSheet->parserSetUsesRemUnits(true); bool inViewport = ruleType == StyleRule::Viewport; CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, m_context, inViewport, m_parsedProperties, ruleType); }
size_t Convert::fromString(PVScalarArrayPtr const &pv, string from) { if(from[0]=='[' && from[from.length()]==']') { size_t offset = from.rfind(']'); from = from.substr(1, offset); } std::vector<string> valueList(split(from)); size_t length = valueList.size(); size_t num = fromStringArray(pv,0,length,valueList,0); if(num<length) length = num; pv->setLength(length); return length; }
static std::vector<string> split(string commaSeparatedList) { string::size_type numValues = 1; string::size_type index=0; while(true) { string::size_type pos = commaSeparatedList.find(',',index); if(pos==string::npos) break; numValues++; index = pos +1; } std::vector<string> valueList(numValues,""); index=0; for(size_t i=0; i<numValues; i++) { size_t pos = commaSeparatedList.find(',',index); string value = commaSeparatedList.substr(index,pos); valueList[i] = value; index = pos +1; } return valueList; }
// answers true if aValue is in the string list of white-space separated values aValueList // a case-sensitive search is performed if aCaseSensitive is true bool ChangeCSSInlineStyleTxn::ValueIncludes(const nsAString &aValueList, const nsAString &aValue, bool aCaseSensitive) { nsAutoString valueList(aValueList); bool result = false; valueList.Append(kNullCh); // put an extra null at the end PRUnichar *value = ToNewUnicode(aValue); PRUnichar *start = valueList.BeginWriting(); PRUnichar *end = start; while (kNullCh != *start) { while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space start++; } end = start; while ((kNullCh != *end) && (false == nsCRT::IsAsciiSpace(*end))) { // look for space or end end++; } *end = kNullCh; // end string here if (start < end) { if (aCaseSensitive) { if (!nsCRT::strcmp(value, start)) { result = true; break; } } else { if (nsDependentString(value).Equals(nsDependentString(start), nsCaseInsensitiveStringComparator())) { result = true; break; } } } start = ++end; } NS_Free(value); return result; }
// Answers true if aValue is in the string list of white-space separated values // aValueList. bool ChangeStyleTransaction::ValueIncludes(const nsAString& aValueList, const nsAString& aValue) { nsAutoString valueList(aValueList); bool result = false; // put an extra null at the end valueList.Append(kNullCh); char16_t* value = ToNewUnicode(aValue); char16_t* start = valueList.BeginWriting(); char16_t* end = start; while (kNullCh != *start) { while (kNullCh != *start && nsCRT::IsAsciiSpace(*start)) { // skip leading space start++; } end = start; while (kNullCh != *end && !nsCRT::IsAsciiSpace(*end)) { // look for space or end end++; } // end string here *end = kNullCh; if (start < end) { if (nsDependentString(value).Equals(nsDependentString(start), nsCaseInsensitiveStringComparator())) { result = true; break; } } start = ++end; } free(value); return result; }
bool MCCacheWriter::preparePragmaList() { size_t pragmaCount = mpOwner->getPragmaCount(); size_t listSize = sizeof(MCO_PragmaList) + sizeof(MCO_Pragma) * pragmaCount; MCO_PragmaList *list = (MCO_PragmaList *)malloc(listSize); if (!list) { ALOGE("Unable to allocate for pragma list\n"); return false; } mpPragmaListSection = list; mpHeaderSection->pragma_list_size = listSize; list->count = pragmaCount; vector<char const *> keyList(pragmaCount); vector<char const *> valueList(pragmaCount); mpOwner->getPragmaList(pragmaCount, &*keyList.begin(), &*valueList.begin()); for (size_t i = 0; i < pragmaCount; ++i) { char const *key = keyList[i]; char const *value = valueList[i]; size_t keyLen = strlen(key); size_t valueLen = strlen(value); MCO_Pragma *pragma = &list->list[i]; pragma->key_strp_index = addString(key, keyLen); pragma->value_strp_index = addString(value, valueLen); } return true; }
void HyperbolicSolver< Mesh, SolverType >:: updateGhostValues ( typename MeshPartitioner<Mesh>::GhostEntityDataMap_Type& ghostDataMap ) { // fill send buffer buffer_Type sendBuffer; // TODO: move this to a const reference typename MeshPartitioner<Mesh>::GhostEntityDataMap_Type::const_iterator procIt = ghostDataMap.begin(); typename MeshPartitioner<Mesh>::GhostEntityDataMap_Type::const_iterator procEnd = ghostDataMap.end(); typename MeshPartitioner<Mesh>::GhostEntityDataContainer_Type::const_iterator dataIt; typename MeshPartitioner<Mesh>::GhostEntityDataContainer_Type::const_iterator dataEnd; for ( ; procIt != procEnd; ++procIt ) { std::vector<Real> valueList ( sendBuffer[ procIt->first ] ); dataEnd = procIt->second.end(); for ( dataIt = procIt->second.begin(); dataIt != dataEnd; ++dataIt ) { ID elementId ( M_FESpace.mesh()->faceElement ( dataIt->localFacetId, 0 ) ); VectorElemental ghostValue ( M_FESpace.refFE().nbDof(), 1 ); extract_vec ( *M_uOld, ghostValue, M_FESpace.refFE(), M_FESpace.dof(), elementId, 0 ); // TODO: this works only for P0 sendBuffer[ procIt->first ].push_back ( ghostValue[ 0 ] ); } } // organize recvBuffer buffer_Type recvBuffer ( sendBuffer ); // send data MPI_Status status; for ( Int proc = 0; proc < M_displayer.comm()->NumProc(); proc++ ) { if ( proc != M_displayer.comm()->MyPID() ) { MPI_Send ( &sendBuffer[ proc ][ 0 ], sendBuffer[ proc ].size(), MPI_DOUBLE, proc, M_displayer.comm()->MyPID() + 1000 * proc, ( boost::dynamic_pointer_cast <Epetra_MpiComm> (M_displayer.comm() ) )->Comm() ); MPI_Recv ( &recvBuffer[ proc ][ 0 ], recvBuffer[ proc ].size(), MPI_DOUBLE, proc, proc + 1000 * M_displayer.comm()->MyPID(), ( boost::dynamic_pointer_cast <Epetra_MpiComm> (M_displayer.comm() ) )->Comm(), &status ); } } // store data in the M_ghostDataMap member for ( buffer_Type::const_iterator procIt = recvBuffer.begin(); procIt != recvBuffer.end(); ++procIt ) { UInt count ( 0 ); for ( ghostDataContainer_Type::const_iterator dataIt = procIt->second.begin(); dataIt != procIt->second.end(); ++dataIt, count++ ) { ID ghostFaceId = ghostDataMap[ procIt->first ][ count ].localFacetId; M_ghostDataMap[ ghostFaceId ] = *dataIt; } } // DEBUG // std::ofstream outf ( ( "hype." + boost::lexical_cast<std::string> ( M_displayer.comm()->MyPID() ) + ".out" ).c_str() ); // outf << M_uOld->epetraVector() << std::endl << std::endl; // // for ( buffer_Type::const_iterator procIt = recvBuffer.begin(); procIt != recvBuffer.end(); ++procIt ) // { // outf << "proc " << procIt->first << " size " << recvBuffer[ procIt->first ].size() << std::endl; // UInt count ( 0 ); // for ( procData_Type::const_iterator dataIt = procIt->second.begin(); dataIt != procIt->second.end(); ++dataIt, count++ ) // { // ID ghostFaceId = ghostDataMap[ procIt->first ][ count ].localFacetId; // ID elementId ( M_FESpace.mesh()->faceElement( ghostFaceId, 0 ) ); // outf << "lid " << elementId << " " << "gid " << ghostDataMap[ procIt->first ][ count ].ghostElementLocalId << " " << *dataIt << std::endl; // } // } } // updateGhostValues
void Compiler::DefineValue( const yy::location& location, int type, ValueList* pValueList ) { std::auto_ptr < ValueList > valueList( pValueList ); pValueList->ForEach( DefValue( this, type ) ); }