From 7432c0aead096ca3cd34f0e49534786a96df94fc Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 22 Jun 2015 00:35:35 -0400 Subject: [PATCH] CLI2: Added ::getToken method for obtaining the canonical form, if possible --- src/CLI2.cpp | 10 ++++++++++ src/CLI2.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 55df8e7c2..10022f5c9 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -137,6 +137,16 @@ const std::string A2::attribute (const std::string& name) const return ""; } +//////////////////////////////////////////////////////////////////////////////// +const std::string A2::getToken () const +{ + auto i = _attributes.find ("canonical"); + if (i == _attributes.end ()) + i = _attributes.find ("raw"); + + return i->second; +} + //////////////////////////////////////////////////////////////////////////////// const std::string A2::dump () const { diff --git a/src/CLI2.h b/src/CLI2.h index 168caa683..3678a1771 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -47,6 +47,7 @@ public: void attribute (const std::string&, const std::string&); void attribute (const std::string&, const int); const std::string attribute (const std::string&) const; + const std::string getToken () const; const std::string dump () const; public: