XmlOptions are now const within Sentence.

This commit is contained in:
Ulrich Germann 2015-12-04 19:43:37 +00:00
parent 4983aa0980
commit 889a33dcd6
6 changed files with 9 additions and 9 deletions

View File

@ -206,7 +206,7 @@ init(string line, std::vector<FactorType> const& factorOrder,
// only fill the vector if we are parsing XML
if (opts.input.xml_policy != XmlPassThrough) {
m_xmlCoverageMap.assign(GetSize(), false);
BOOST_FOREACH(XmlOption* o, m_xmlOptions) {
BOOST_FOREACH(XmlOption const* o, m_xmlOptions) {
Range const& r = o->range;
for(size_t j = r.GetStartPos(); j <= r.GetEndPos(); ++j)
m_xmlCoverageMap[j]=true;
@ -291,7 +291,7 @@ bool Sentence::XmlOverlap(size_t startPos, size_t endPos) const
void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list) const
{
for (std::vector<XmlOption*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
for (std::vector<XmlOption const*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
iterXMLOpts != m_xmlOptions.end(); ++iterXMLOpts) {
const XmlOption &xmlOption = **iterXMLOpts;
const Range &range = xmlOption.range;
@ -305,7 +305,7 @@ void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list,
{
//iterate over XmlOptions list, find exact source/target matches
for (std::vector<XmlOption*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
for (std::vector<XmlOption const*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
iterXMLOpts != m_xmlOptions.end(); ++iterXMLOpts) {
const XmlOption &xmlOption = **iterXMLOpts;
const Range &range = xmlOption.range;
@ -338,7 +338,7 @@ GetXmlChartTranslationOptions(AllOptions const& opts) const
//iterXMLOpts will be empty for XmlIgnore
//look at each column
for(std::vector<XmlOption*>::const_iterator iterXmlOpts = m_xmlOptions.begin();
for(std::vector<XmlOption const*>::const_iterator iterXmlOpts = m_xmlOptions.begin();
iterXmlOpts != m_xmlOptions.end(); iterXmlOpts++) {
const XmlOption &xmlOption = **iterXmlOpts;

View File

@ -52,7 +52,7 @@ protected:
* Utility method that takes in a string representing an XML tag and the name of the attribute,
* and returns the value of that tag if present, empty string otherwise
*/
std::vector<XmlOption*> m_xmlOptions;
std::vector<XmlOption const*> m_xmlOptions;
std::vector <bool> m_xmlCoverageMap;
NonTerminalSet m_defaultLabelSet;

View File

@ -26,7 +26,7 @@ bool
TreeInput::
ProcessAndStripXMLTags(AllOptions const& opts, string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &xmlOptions)
std::vector<XmlOption const*> &xmlOptions)
{
//parse XML markup in translation line

View File

@ -45,7 +45,7 @@ protected:
bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &res);
std::vector<XmlOption const*> &res);
public:
TreeInput() : Sentence() { }

View File

@ -159,7 +159,7 @@ vector<string> TokenizeXml(const string& str, const std::string& lbrackStr, cons
* \param rbrackStr xml tag's right bracket string, typically ">"
*/
bool
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption*> &res,
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption const*> &res,
ReorderingConstraint &reorderingConstraint,
vector< size_t > &walls,
std::vector< std::pair<size_t, std::string> > &placeholders,

View File

@ -31,7 +31,7 @@ bool isXmlTag(const std::string& tag, const std::string& lbrackStr="<", const st
std::vector<std::string> TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
bool ProcessAndStripXMLTags(AllOptions const& opts,
std::string &line, std::vector<XmlOption*> &res,
std::string &line, std::vector<XmlOption const*> &res,
ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
std::vector< std::pair<size_t, std::string> > &placeholders,
int offset,