本文整理汇总了C++中AttributeList::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::getValue方法的具体用法?C++ AttributeList::getValue怎么用?C++ AttributeList::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeList
的用法示例。
在下文中一共展示了AttributeList::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadError
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);
}
}
示例2: StoreNameValueAttributes
/*
* Stores the attributes from a name value type element.
* Parse out the probe array type into its own member.
*/
void SAXArrayHandlers::StoreNameValueAttributes(AttributeList& attributes)
{
unsigned int len = attributes.getLength();
AttributeNameValueType param;
for (unsigned int index = 0; index < len; index++)
{
if (attributes.getName(index) == NAME_ATTRIBUTE)
{
param.name = XMLChToString(attributes.getValue(index));
}
else if (attributes.getName(index) == VALUE_ATTRIBUTE)
{
param.value = XMLChToString(attributes.getValue(index));
}
else if (attributes.getName(index) == TYPE_ATTRIBUTE)
{
param.type = XMLChToString(attributes.getValue(index));
if (param.name == PROBE_ARRAY_TYPE_PARAMETER_NAME)
{
arrayData->SetArrayType(param.value);
}
else
{
arrayData->Attributes().push_back(param);
}
}
}
}
示例3: TransStart
/*
* 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") ;
}
示例4: SectionStart
/*
* 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 ");
}
示例5: if
// 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);
}
}
示例6: EventStart
// 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) ) ;
}
示例7: startElement
void BulletMLParserXercesSAXHandler::startElement(const XMLCh* const name,
AttributeList& attributes)
{
BulletMLNode* node = parser_->addContent(parser_->uc2string(name));
if (node->getName() == BulletMLNode::bulletml) {
for (unsigned int i = 0; i < attributes.getLength(); i++) {
if (parser_->uc2string(attributes.getName(i)) == "type" &&
parser_->uc2string(attributes.getValue(i)) == "horizontal")
{
parser_->setHorizontal();
}
}
}
else {
BulletMLParserXerces::MyAttributes mattr;
for (unsigned int i = 0; i < attributes.getLength(); i++) {
mattr.push_back(parser_->uc2string(attributes.getName(i)));
mattr.push_back(parser_->uc2string(attributes.getValue(i)));
}
parser_->addAttribute(mattr, node);
}
if (curNode_ != 0) curNode_->addChild(node);
curNode_ = node;
}
示例8: BackgroundStart
// 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" ;
}
}
示例9: LangStart
// 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;
}
}
示例10: TopicStart
// 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) ;
}
示例11: SpeakerStart
void SAX_SGMLHandler::SpeakerStart(const XMLCh* const name, AttributeList& attr)
{
const string& tag = trans(name);
TRACE(string("IN SpeakerStart ") + tag);
if (tag == "PATH") {
string id, word_cnt, labels, file, chanel, sequence, r_t1, r_t2, word_aux ;
id = trans(attr.getValue("id")) ;
word_cnt = trans(attr.getValue("word_cnt")) ;
labels = trans(attr.getValue("labels")) ;
file = trans(attr.getValue("file")) ;
chanel = trans(attr.getValue("chanel")) ;
sequence = trans(attr.getValue("sequence")) ;
r_t1 = trans(attr.getValue("R_T1")) ;
r_t2 = trans(attr.getValue("R_T2")) ;
word_aux = trans(attr.getValue("word_aux")) ;
if (current_SGMLspeaker) {
current_SGMLpath = current_SGMLspeaker->addPath(id, word_cnt, labels, file, chanel, sequence, r_t1, r_t2, word_aux) ;
sgmlModel->addPath(current_SGMLpath) ;
}
StartStack.push(&SAX_SGMLHandler::PathStart) ;
EndStack.push(&SAX_SGMLHandler::PathEnd) ;
}
else {
TRACE("UNKNOWN TAG: " + tag);
StartStack.push(&SAX_SGMLHandler::SpeakerStart) ;
EndStack.push(&SAX_SGMLHandler::dummyEnd) ;
}
}
示例12: SGMLSubStart
void SAX_SGMLHandler::SGMLSubStart(const XMLCh* const name, AttributeList& attr)
{
const string& tag = trans(name);
TRACE(string("IN SGMLSubStart ") + tag);
if (tag == "SYSTEM") {
string title, ref_fname, hyp_fname, creation_date, format, frag_corr, opt_del, weight_ali, weight_filename ;
title = trans(attr.getValue("id")) ;
ref_fname = trans(attr.getValue("ref_fname")) ;
hyp_fname = trans(attr.getValue("hyp_fname")) ;
creation_date = trans(attr.getValue("creation_date")) ;
format = trans(attr.getValue("format")) ;
frag_corr = trans(attr.getValue("frag_corr")) ;
opt_del = trans(attr.getValue("opt_del")) ;
weight_ali = trans(attr.getValue("weight_ali")) ;
weight_filename = trans(attr.getValue("weight_filename")) ;
if (sgmlModel)
sgmlModel->setData(title, ref_fname, hyp_fname, creation_date, format, frag_corr, opt_del, weight_ali, weight_filename) ;
else
Log::err() << "SGML: no model handler... Error" << std::endl ;
StartStack.push(&SAX_SGMLHandler::SystemStart) ;
EndStack.push(&SAX_SGMLHandler::dummyEnd) ;
}
else {
TRACE("UNKNOWN TAG: " + tag);
StartStack.push(&SAX_SGMLHandler::SGMLSubStart);
EndStack.push(&SAX_SGMLHandler::dummyEnd);
}
TRACE("OUT SGMLSubStart");
}
示例13: startElement
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;
}
示例14:
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);
}
示例15: trans
// deal with "comment" items
void SAX_TRSHandlers::CommentStart
(const XMLCh* const name, AttributeList& attr)
{
string type = "comment";
string desc = trans(attr.getValue("desc"));
syncStack[who].push_back( new SyncContent(who, SyncContent::EVENT_INSTANT, type, desc) ) ;
}