本文整理汇总了C++中Position::Column方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::Column方法的具体用法?C++ Position::Column怎么用?C++ Position::Column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::Column方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
template<class ElemType> int
StringAssocTable<ElemType>::addElement (const char* _name,
ElemType *_meu, Position& _pos)
{
if (finalized)
{
assert (!"StringAssocTable: Cannot add new elements after the configuration was finalized.");
return (NO_MAPPING);
}
StringAssocMap::iterator it = find(_name);
if (it == end() || !strictCheck) // new name
{
int id = nextId++;
if (it==end())
insert(StringAssocMap::value_type(_name, id));
else
it->second = id;
_meu->setNameAndPosition (_name, _pos);
elements.evector->push_back (_meu);
return (id);
} else // name is already in the table and strictCheck is set
{
haveErrors += 1;
ElemType *meu = (*elements.evector)[it->second];
fprintf(stderr, "Error %d (%d, %d): Identifier '%s' has been defined before at (%d,%d)\n",
haveErrors, _pos.Line(), _pos.Column(), _name,
meu->getPosition().Line(), meu->getPosition().Column() );
return (it->second);
}
}
示例2: find
template<class ElemType> int
StringAssocTable<ElemType>::getMappingForName(const char* _name,
Position& _pos)
{
StringAssocMap::iterator it = find(_name);
if (it == end()) // new name
{
haveErrors += 1;
fprintf(stderr, "Error %d (%d, %d): Identifier '%s' is used but was not defined.\n",
haveErrors, _pos.Line(), _pos.Column(), _name);
return (NO_MAPPING);
} else // name is already in the table
{
return (it->second);
}
}