예제 #1
0
// deal with "background" items
void SAX_TRSHandlers::BackgroundStart(const XMLCh* const name, AttributeList& attr)
{
	nbBackground ++ ;

	string startTime = trans(attr.getValue("time"));
	float start = atof(startTime.c_str());

	//> Create background if not at 0 time
	//  if 0 time, will be created at next background border
	float lastTime = atof(lastBackgroundTime.c_str());
	if (lastTime!=0)
	{
//		prevBackgroundId = dataModel->addBackgroundSegment(0, lastTime, -1, formatBackgrounds(lastBackgroundType), lastBackgroundLevel, tag::DataModel::ADJUST_PREVIOUS, false) ;
		prevBackgroundId = dataModel->insertMainstreamBaseElement(prevBackgroundId, lastTime);
		dataModel->setElementProperty(prevBackgroundId, "type", formatBackgrounds(lastBackgroundType), false);
		dataModel->setElementProperty(prevBackgroundId, "level", lastBackgroundLevel, false);
	}

	lastBackgroundTime = startTime ;
	string level = trans(attr.getValue("level"));
	string type = trans(attr.getValue("type"));

	if (level!="off")
	{
		lastBackgroundLevel = level ;
		lastBackgroundType = type ;
	}
	else
	{
		lastBackgroundLevel = "low" ;
		lastBackgroundType = "none" ;
	}
}
/* ****************************************************************************
*
* mongoGetContextElementResponses_fail -
*/
TEST(mongoOntimeintervalOperations, mongoGetContextElementResponses_fail)
{
    HttpStatusCode ms;

    /* Forge the parameters */
    EntityIdVector enV;
    EntityId en("E5", "T", "false");
    enV.push_back(&en);
    AttributeList attrL;
    attrL.push_back("A1");
    attrL.push_back("A2");
    attrL.push_back("A3");
    attrL.push_back("A4");
    ContextElementResponseVector cerV;
    std::string err;

    /* Prepare database */
    prepareDatabase();

    /* Do operation */
    ms = mongoGetContextElementResponses(enV, attrL, &cerV, &err);

    /* Check results */
    EXPECT_EQ(SccOk, ms);
    ASSERT_EQ(0, cerV.size());
}
예제 #3
0
/// HandleAddressSpaceTypeAttribute - Process an address_space attribute on the
/// specified type.  The attribute contains 1 argument, the id of the address
/// space for the type.
static void HandleAddressSpaceTypeAttribute(QualType &Type, 
                                            const AttributeList &Attr, Sema &S){
  // If this type is already address space qualified, reject it.
  // Clause 6.7.3 - Type qualifiers: "No type shall be qualified by qualifiers
  // for two or more different address spaces."
  if (Type.getAddressSpace()) {
    S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers);
    return;
  }
  
  // Check the attribute arguments.
  if (Attr.getNumArgs() != 1) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
    return;
  }
  Expr *ASArgExpr = static_cast<Expr *>(Attr.getArg(0));
  llvm::APSInt addrSpace(32);
  if (!ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) {
    S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int)
      << ASArgExpr->getSourceRange();
    return;
  }

  unsigned ASIdx = static_cast<unsigned>(addrSpace.getZExtValue()); 
  Type = S.Context.getAddrSpaceQualType(Type, ASIdx);
}
예제 #4
0
static void HandleX86ForceAlignArgPointerAttr(Decl *D,
                                              const AttributeList& Attr,
                                              Sema &S) {
  // Check the attribute arguments.
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
    return;
  }

  // If we try to apply it to a function pointer, don't warn, but don't
  // do anything, either. It doesn't matter anyway, because there's nothing
  // special about calling a force_align_arg_pointer function.
  ValueDecl *VD = dyn_cast<ValueDecl>(D);
  if (VD && VD->getType()->isFunctionPointerType())
    return;
  // Also don't warn on function pointer typedefs.
  TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D);
  if (TD && (TD->getUnderlyingType()->isFunctionPointerType() ||
             TD->getUnderlyingType()->isFunctionType()))
    return;
  // Attribute can only be applied to function types.
  if (!isa<FunctionDecl>(D)) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
      << Attr.getName() << /* function */0;
    return;
  }

  D->addAttr(::new (S.Context) X86ForceAlignArgPointerAttr(Attr.getRange(),
                                                           S.Context));
}
예제 #5
0
static bool produceCompactUnwindFrame(MachineFunction &MF) {
  const AArch64Subtarget &Subtarget = MF.getSubtarget<AArch64Subtarget>();
  AttributeList Attrs = MF.getFunction()->getAttributes();
  return Subtarget.isTargetMachO() &&
         !(Subtarget.getTargetLowering()->supportSwiftError() &&
           Attrs.hasAttrSomewhere(Attribute::SwiftError));
}
예제 #6
0
AttributeList
OGR_Feature::getAttributes() const
{
    AttributeTable attrs;

    if ( !store_attrs_loaded )
    {
        const_cast<OGR_Feature*>(this)->loadAttributes();
    }

    // accumulate the attrs from the store:
    for( AttributeTable::const_iterator i = store_attrs.begin(); i != store_attrs.end(); i++ )
    {
        attrs[ (*i).first ] = (*i).second;
    }

    // finally add in the user attrs (overwriting the store attrs if necessary)
    for( AttributeTable::const_iterator i = getUserAttrs().begin(); i != getUserAttrs().end() ; i++ )
        attrs[ (*i).first ] = (*i).second;

    // shove it all into a list
    AttributeList result;
    for( AttributeTable::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
        result.push_back( (*i).second );

    return result;
}
void SAXPrintHandlers::startElement(const   XMLCh* const    name
                                    ,       AttributeList&  attributes)
{
    // The name has to be representable without any escapes
    fFormatter  << XMLFormatter::NoEscapes
                << chOpenAngle << name;

    unsigned int len = attributes.getLength();
    for (unsigned int index = 0; index < len; index++)
    {
        //
        //  Again the name has to be completely representable. But the
        //  attribute can have refs and requires the attribute style
        //  escaping.
        //
        fFormatter  << XMLFormatter::NoEscapes
                    << chSpace << attributes.getName(index)
                    << chEqual << chDoubleQuote
                    << XMLFormatter::AttrEscapes
		            << attributes.getValue(index)
                    << XMLFormatter::NoEscapes
                    << chDoubleQuote;
    }
    fFormatter << chCloseAngle;
}
예제 #8
0
파일: parser.cpp 프로젝트: ierofant/rise
void rise::parser::on_start_element(const Glib::ustring &_name,
                    		    const AttributeList &_attributes)
{
    Glib::ustring prefix, name = _name;
    auto pos = _name.find(':');
    if(pos != Glib::ustring::npos)
    {
	prefix = _name.substr(0, pos);
	name = _name.substr(pos + 1);
    }

    auto *el = doc.get_root_node();
    if(!el) el = doc.create_root_node();
    else el = context.top()->add_child(name, prefix);
    context.push(el);

    for(auto itr = _attributes.begin(); itr != _attributes.end(); ++itr)
    {
	Glib::ustring name = itr->name;
	Glib::ustring value = itr->value;
	auto pos = name.find(':');
	if(pos == Glib::ustring::npos)
	{
	    if(name == "xmlns") el->set_namespace_declaration(value);
	    else el->set_attribute(name, value);
	}
	else
	{
	    Glib::ustring prefix = name.substr(0, pos);
	    Glib::ustring suffix = name.substr(pos + 1);
	    if(prefix == "xmlns") el->set_namespace_declaration(value, suffix);
	    else el->set_attribute(suffix, value, prefix);
	}
    }
}
예제 #9
0
void SAX_TransAGHandler::AGSetStart
(const XMLCh* const name, AttributeList& attr)
{
	string id = trans(attr.getValue("id")) ;
	string version = trans(attr.getValue("version")) ;

	try  {
		prevId = CreateAGSet(id);
		agIds.clear();    // erase ids of previous load
		agSetIds.push_back(prevId);

		a_version = version ;
		a_agId =  id ;

		StartStack.push(&SAX_TransAGHandler::AGSetSubStart);
		EndStack.push(&SAX_TransAGHandler::dummyEnd);
	}
	catch ( AGException e ) {
		throw agfio::LoadError(e.error());
	}
	catch ( ... ) {
		string msg = "AGSetStart : id '" + id + "'already exists ";
		throw agfio::LoadError(msg);
	}

}
예제 #10
0
// invoked at the start of a subelement of AGSet
void SAX_TransAGHandler::AGSetSubStart
(const XMLCh* const name, AttributeList& attr)
{
  string tag = trans(name);

  if (!a_agId.empty() && !a_version.empty())
  	SetFeature(a_agId, "version", a_version) ;

  // if Metadata element is found
  if (tag == "Metadata") {
    StartStack.push(&SAX_TransAGHandler::MetadataSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  // if Timeline element is found
  else if (tag == "Timeline") {
    prevId = CreateTimeline(trans(attr.getValue("id")));
    StartStack.push(&SAX_TransAGHandler::TimelineSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  // if AG element is found
  else if (tag == "AG") {
    prevId = CreateAG(trans(attr.getValue("id")),
                      trans(attr.getValue("timeline")));

    agIds.push_back(prevId);
    StartStack.push(&SAX_TransAGHandler::AGSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
}
예제 #11
0
TextEncoding HTMLMetaCharsetParser::encodingFromMetaAttributes(const AttributeList& attributes)
{
    bool gotPragma = false;
    Mode mode = None;
    String charset;

    for (AttributeList::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter) {
        const AtomicString& attributeName = iter->first;
        const String& attributeValue = iter->second;

        if (attributeName == http_equivAttr) {
            if (equalIgnoringCase(attributeValue, "content-type"))
                gotPragma = true;
        } else if (charset.isEmpty()) {
            if (attributeName == charsetAttr) {
                charset = attributeValue;
                mode = Charset;
            } else if (attributeName == contentAttr) {
                charset = extractCharset(attributeValue);
                if (charset.length())
                    mode = Pragma;
            }
        }
    }

    if (mode == Charset || (mode == Pragma && gotPragma))
        return TextEncoding(stripLeadingAndTrailingHTMLSpaces(charset));

    return TextEncoding();
}
예제 #12
0
void SAX_TransAGHandler::structuredMetaStart
(const XMLCh* const name, AttributeList& attr)
{
  string s;
  // if start-of-element is reported,
  // store structured element as XML string in feature value
  // and push structuredMetaEnd handler
  //  storeMetaValueStart(name, attr);
  if ( ! prevValue.empty() ) prevValue += " ";
  prevValue += "<";
  prevValue += set_string(s, name);
  for ( int i = 0; i < attr.getLength(); ++i ) {
    prevValue += " ";
    prevValue += set_string(s, attr.getName(i));
    prevValue += "=\"";
    prevValue += set_string(s, attr.getValue(i));
    prevValue += "\"";
  }

  prevValue += ">";
  prevPos = prevValue.length();

  StartStack.push(&SAX_TransAGHandler::structuredMetaStart);
  EndStack.push(&SAX_TransAGHandler::structuredMetaEnd);
}
예제 #13
0
void Connection::bind_parameters( sqlite3_stmt *ppStmt,
                                  const AttributeList &parameters ) {
  int i = 0;
  for( AttributeList::const_iterator it = parameters.begin();
       it != parameters.end();
       ++it ) {
    switch( it->which() ) {
    case integer: {
      int value = boost::get< int >( *it );
      sqlite3_bind_int( ppStmt, i + 1, value );
      break;
    }
    case text: {
      string value = boost::get< std::string >( *it );
      sqlite3_bind_text( ppStmt, i + 1, value.c_str(), value.size(), 0 );
      break;
    }
    case floating_point: {
      double value = boost::get< double >( *it );
      sqlite3_bind_double( ppStmt, i + 1, value );
      break;
    }
    case date: {
      Date value = boost::get< Date >( *it );
      string s   = value.to_string();
      sqlite3_bind_text( ppStmt, i + 1, s.c_str(), s.size(), 0 );
      break;
    }
    default: {
      throw ActiveRecordException( "Type not implemented", __FILE__, __LINE__ );
    }
    }
    ++i;
  }
}
예제 #14
0
AttributeList
SunPyInstance::build_preedit_attribs (const IPreeditString* ppd)
{
    AttributeList attrs;
    const int sz = ppd->charTypeSize();
    for (int i = 0; i < sz; ) {
        const int ct = ppd->charTypeAt(i);
        if (ct & IPreeditString::ILLEGAL) {
            const int start = i;
            for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::ILLEGAL); ++i) ;
            attrs.push_back( Attribute(start, i-start,
                                       SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_REVERSE));
        } else if (ct & IPreeditString::NORMAL_CHAR) {
            if (ct & IPreeditString::USER_CHOICE) {
                const int start = i;
                for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::USER_CHOICE); ++i) ;
                attrs.push_back( Attribute(start, i-start,
                                           SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
            } else {
                ++i;
            }
        } else {
            ++i;
        }
    }
    return attrs;
}
예제 #15
0
/*
 * invoked at the start of a section
 *
 * We can't create the section because the children are not created yet.
 * So we keep the section data and we'll create it as soon as the children are
 * built.
 *
 * Take care:
 * We can create base element (sync tag) only when we arrive at the following
 * element tag (to get the split timestamp). As we need to wait for the base
 * element to be created for creating all parents (like sections), we always create
 * the previous section after encountering a section tag.
 * Therefore, at a section tag, we need to keep data of the previous section and data
 * of the current section.
 */
void SAX_TRSHandlers::SectionStart (const XMLCh* const name, AttributeList& attr)
{
	O_TRACE("IN SectionStart ");

	nbSections++ ;

	// -- As soon as we are at the 2nd section, we can indicates that we'll need
	//	  to create the previous one as soon as the children are built.
	if (nbSections > 1)
		sectionNeeded = true ;


	//>  keep data for the turn that will be created
	lastSectionType = currentSectionType ;
	lastSectionTopic = currentSectionTopic ;

	//>  Keep current data
	const string& topicId = trans(attr.getValue("topic")) ;
	currentSectionType = trans(attr.getValue("type")) ;
	currentSectionTopic = topics[topicId] ;

	if (nbSections==1)
	{
		dataModel->setElementProperty(m_sectId[0], "type", currentSectionType, false) ;
		dataModel->setElementProperty(m_sectId[0], "desc", currentSectionTopic, false) ;

		lastSectionType = currentSectionType ;
		lastSectionTopic = currentSectionTopic ;
	}

	StartStack.push(&SAX_TRSHandlers::TurnStart);
	EndStack.push(&SAX_TRSHandlers::dummyEnd);
	O_TRACE("OUT SectionStart ");
}
예제 #16
0
파일: Program.cpp 프로젝트: dcbishop/dglw
AttributeList Program::getActiveAttributes() const {
   AttributeList al;

   // Get the number of active attributes
   GLint num_attributes;
   getProgram(Program::ActiveAttributes, &num_attributes);

   // The the maximum size of the attribe names
   GLsizei max_name_length;
   getProgram(Program::ActiveAttributeMaxLength, &max_name_length);

   GLsizei length;
   std::vector<GLchar> name(max_name_length);

   for(int index = 0; index < num_attributes; index++) {
      AttributeInfo ai;

      // Retrive atribute data and store it in the info struct
      ai.index = index;
      glGetActiveAttrib(getProgramId(),
         index,
         name.size(),
         &length,
         &ai.size,
         &ai.type,
         &name[0]);
      ai.name = std::string(&name[0], length);

      al.push_back(ai);
   }
   return al;
}
예제 #17
0
/*
 * start trans
 */
void SAX_TRSHandlers::TransStart(const XMLCh* const name, AttributeList& attr)
{
	O_TRACE("IN TransStart");

	// -- Annotation
	if (!dataModel)
	{
		tag::DataModel::initEnviron("");
		dataModel = new tag::DataModel("TRS");
		dataModel->setConventions("trs_import");
	}

	dataModel->setAGSetProperty("annotations", "transcription") ;

	// -- Version
	ostringstream vers;
	string scribe = trans(attr.getValue("scribe")) ;
	dataModel->initVersionInfo(scribe , trans(attr.getValue("version_date")) ) ;

	// -- Status
	ostringstream status;
	status << "elapsed=" << trans(attr.getValue("elapsed")) << ";";
	dataModel->setAGSetProperty("status", status.str()) ;

	// -- Signal
	signalIds = dataModel->addSignal(trans(attr.getValue("audio_filename")), "audio", "wav", "PCM", dataModel->getNbTracks() + 1, 1);
	signalId = signalIds.back() ;

	// -- Language
	lang = trans(attr.getValue("xml:lang"));
	if ( lang.length() == 2 )
	{
		const char* plang= ISO639::get3LetterCode(lang.c_str());
		if ( *plang )
			lang=plang;
	}

	// -- Keep value of all initialized elements.
	// We'll use them to cut the element timelines each time we want to create an element
	string prevId = dataModel->getAGTrans() ;
	dataModel->initAnnotationGraphs("", lang, scribe);
	m_sectId[0] = dataModel->getByOffset("section", 0.0, 0, "transcription_graph") ;
	m_turnId[0] = dataModel->getByOffset("turn", 0.0, 0, "transcription_graph") ;
	m_segmentId[0] = dataModel->getByOffset("segment", 0.0, 0, "transcription_graph") ;
	m_unitId[0] = dataModel->getByOffset("unit", 0.0, 0, "transcription_graph") ;
	prevBackgroundId  = dataModel->getByOffset("background", 0.0, 0, "background_graph") ;
	if (!prevBackgroundId.empty())
	{
		dataModel->setElementProperty(prevBackgroundId, "type", "none") ;
		dataModel->setElementProperty(prevBackgroundId, "level", "low") ;
	}

	// -- Values used for keeping the creation order
	turnIds.push_back(m_turnId[0]);
	segIds.push_back(m_segmentId[0]);

	StartStack.push(&SAX_TRSHandlers::TransSubStart);
	EndStack.push(&SAX_TRSHandlers::TransEnd);
	O_TRACE("OUT TransStart") ;
}
예제 #18
0
// deal with "event" items
void SAX_TRSHandlers::EventStart(const XMLCh* const name, AttributeList& attr)
{
	string type = trans(attr.getValue("type"));
	string extent = trans(attr.getValue("extent"));
	string desc = trans(attr.getValue("desc"));

	bool is_entity = false ;
	SyncContent::SyncContentMode mode ;

	//> type empty ? let's consider it as a noise
	if ( type.empty() )
		type = "noise";
	//> type is entities ? we have an entity type too
	else if ( type == "entities" )
		is_entity = true ;

	//> Format it
	formatAGqualifier(is_entity, type, desc) ;

	//> Event has not specific extent ? let's say it's instantaneous
	//  --> Instantaneous = foreground event
	if ( extent.empty() || extent == "instantaneous" )
		mode = SyncContent::EVENT_INSTANT ;
	else if ( extent == "begin" )
		mode = SyncContent::EVENT_BEGIN ;
	else if (extent == "end")
		mode = SyncContent::EVENT_END ;
	else if (extent == "next")
		mode = SyncContent::EVENT_NEXT ;
	else if (extent == "previous")
		mode = SyncContent::EVENT_PREVIOUS ;

	syncStack[who].push_back( new SyncContent(who, mode, type, desc) ) ;
}
예제 #19
0
bool Connection::table_exists( const string &table_name ) {
  AttributeList parameters;
  parameters.push_back( table_name );
  RowSet rows = select_all( "SELECT name FROM sqlite_master WHERE type='table' AND name = ?;",
                            parameters );
  return ( rows.size() ? true : false );
}
예제 #20
0
/**
 * @brief VoiceEndpoint::sendDictationResults
 * Important: Pebble accepts only 1 sentence currently, hence need to choose the best one here
 */
void VoiceEndpoint::sendDictationResults()
{
    if(m_sessId>0) {
        if(m_sesTimer) {
            killTimer(m_sesTimer);
            m_sesTimer = 0;
            m_sesPhase = PhResultSent;
        }
        quint32 flags = m_appUuid.isNull()?0:FlagAppInitiated;
        quint8 result = (m_sesResult.sentences.count()>0)?ResSuccess:ResInvalidRecognizerResponse;
        qDebug() << "Sending session recognition result" << result << "for session" << m_sessId << "with content" << m_sesResult.sentences.count() << "for app" << m_appUuid << m_appUuid.isNull();
        QByteArray pkt;
        WatchDataWriter writer(&pkt);
        writer.write<quint8>(CmdDictatResult);
        writer.writeLE<quint32>(flags);
        writer.writeLE<quint16>(m_sessId);
        writer.write<quint8>(result);
        AttributeList al;
        if(!m_appUuid.isNull())
            al.append(Attribute(m_appUuid));
        m_sesResult.sort(1);
        if(result==ResSuccess)
            al.append(Attribute(Transcription(m_sesResult)));
        al.writerWrite(writer);
        m_watchConnection->writeToPebble(WatchConnection::EndpointVoiceControl,pkt);
        qDebug() << "Sent" << pkt.toHex();
    }
}
예제 #21
0
void
AttributedNode::addAttributes( const AttributeList& attrs )
{
    for( AttributeList::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
    {
        this->setAttribute( *i );
    }
}
예제 #22
0
 void startElement(const XMLCh* const name, AttributeList& attrList)
 {
   string label=XMLString::transcode(name);
   map<string,string> attrs;
   for (unsigned int i=0;i<attrList.getLength();i++)
     attrs[XMLString::transcode(attrList.getName(i))] = XMLString::transcode(attrList.getValue(i));
   myStream.onElement(label, attrs);
 }
예제 #23
0
// deal with "Lang" items
void SAX_TRSHandlers::LangStart(const XMLCh* const name, AttributeList& attr)
{
	float score = atof(trans(attr.getValue("score")).c_str());
	if ( score > 0.0 && score > prevScore )
	{
		dataModel->setElementProperty(turnIds[who-1], "lang", trans(attr.getValue("name")), false) ;
		prevScore = score;
	}
}
	void beginElement( void * userdata, const XML_Char * nam, const XML_Char ** atts){
		AttributeList::const_iterator iter;
		XML * xml = (XML *)userdata;
		string tname (nam);
		AttributeList attributes (atts);
		GalaxyNames elem = (GalaxyNames) element_map.lookup(tname);
		GalaxyNames attr;
		string name;
		string value;
		switch (elem) {
		case GALAXY:
			break;
		case SYSTEMS:
                  break;
                case PLANETS:
			xml->stak.push_back ("<planets>");
			xml->g->addSection (xml->stak);
			break;
		case SECTOR:
		case SYSTEM:

                case PLANET:
			for (iter = attributes.begin(); iter!=attributes.end();++iter) {
				attr = (GalaxyNames)attribute_map.lookup((*iter).name);
				switch (attr) {
				case NAME:
					name = (*iter).value;
					break;
				default:
					break;
				}
			}
			xml->stak.push_back (name);
			xml->g->addSection (xml->stak);

			break;
		case VAR:
			for (iter = attributes.begin(); iter!=attributes.end();++iter) {
				attr = (GalaxyNames)attribute_map.lookup((*iter).name);
				switch(attr) {
				case NAME:
					name = (*iter).value;
					break;
				case VALUE:
					value = (*iter).value;
					break;
				default:break;
				}
			}
			xml->g->setVariable(xml->stak,name,value);
			break;
		default:break;
		}

		
	}
AttributeList Connection::select_values( const string &query,
					 const AttributeList &parameters ) {
  sqlite3_stmt *ppStmt = prepare( query, parameters );
  AttributeList results;
  while( sqlite3_step( ppStmt ) == SQLITE_ROW ) {
    results.push_back( Attribute::from_field( ppStmt, 0 ) );
  }
  sqlite3_finalize( ppStmt );
  return results;
}
예제 #26
0
string Renderer::generateAttributes(const AttributeList& attributes)
{
	string str;
	AttributeList::const_iterator itr;
	for(itr = attributes.begin();itr!=attributes.end();itr++)
	{
		str += (" " + itr->first + "=\"" + itr->second + "\" ");
	}
	return str;
}
예제 #27
0
파일: View.cpp 프로젝트: GYGit/ffead-cpp
string View::generateAttributes(AttributeList attributes)
{
	string str;
	AttributeList::iterator itr;
	for(itr = attributes.begin();itr!=attributes.end();itr++)
	{
		str += (" " + itr->first + "=\"" + itr->second + "\" ");
	}
	return str;
}
예제 #28
0
/// HandleObjCGCTypeAttribute - Process an objc's gc attribute on the
/// specified type.  The attribute contains 1 argument, weak or strong.
static void HandleObjCGCTypeAttribute(QualType &Type, 
                                      const AttributeList &Attr, Sema &S) {
  if (Type.getObjCGCAttr() != QualType::GCNone) {
    S.Diag(Attr.getLoc(), diag::err_attribute_multiple_objc_gc);
    return;
  }
  
  // Check the attribute arguments.
  if (!Attr.getParameterName()) {    
    S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
      << "objc_gc" << 1;
    return;
  }
  QualType::GCAttrTypes GCAttr;
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
    return;
  }
  if (Attr.getParameterName()->isStr("weak")) 
    GCAttr = QualType::Weak;
  else if (Attr.getParameterName()->isStr("strong"))
    GCAttr = QualType::Strong;
  else {
    S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
      << "objc_gc" << Attr.getParameterName();
    return;
  }
  
  Type = S.Context.getObjCGCQualType(Type, GCAttr);
}
예제 #29
0
// invoked at the start of a subelement of AG
void SAX_TransAGHandler::AGSubStart
(const XMLCh* const name, AttributeList& attr)
{
  string tag = trans(name);

  if (tag == "Metadata") {
    StartStack.push(&SAX_TransAGHandler::MetadataSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  else if (tag == "Anchor") {
    string unit = trans(attr.getValue("unit"));
    string off_str = trans(attr.getValue("offset"));
    set<SignalId> sigset;
    Utilities::string2set(trans(attr.getValue("signals")), sigset);
    if (off_str.empty())
      CreateAnchor(trans(attr.getValue("id")), sigset);
    else
      CreateAnchor(trans(attr.getValue("id")),
		   atof(off_str.c_str()),
		   unit,
		   sigset);

    StartStack.push(&SAX_TransAGHandler::dummyStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  else if (tag == "Annotation") {
    prevId =
      CreateAnnotation(trans(attr.getValue("id")),
                       trans(attr.getValue("start")),
                       trans(attr.getValue("end")),
                       trans(attr.getValue("type")));
    StartStack.push(&SAX_TransAGHandler::AnnotationSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
}
예제 #30
0
// invoked at the start of a topic definition
void SAX_TRSHandlers::TopicStart(const XMLCh* const name, AttributeList& attr)
{
	O_TRACE("IN TopicStart ");

	topics[trans(attr.getValue("id"))] = trans(attr.getValue("desc"));

	O_TRACE("OUT TopicStart ") ;

	StartStack.push(&SAX_TRSHandlers::dummyStart) ;
	EndStack.push(&SAX_TRSHandlers::dummyEnd) ;
}