Use colon syntax for FQNames for enum values.
example: android.hardware.foo@1.0::IFoo.IFooInternal.FooEnum:ENUM_OK
In constant expressions they are emitted as-is, so the emit code won't
compile.
Also split regex rule 4 into two rules in FQName.cpp, to single out
the case for identifiers.
Test: not tested. This CL require child CLs to work.
Bug: 31682916
Change-Id: Ib376dc8c4a27894f7b0eb6d017d9f69242d25b45
diff --git a/FQName.h b/FQName.h
index c71da9e..1a4ee1d 100644
--- a/FQName.h
+++ b/FQName.h
@@ -30,9 +30,11 @@
FQName(const std::string &package,
const std::string &version,
- const std::string &name);
+ const std::string &name,
+ const std::string &valueName = "");
bool isValid() const;
+ bool isIdentifier() const;
bool setTo(const std::string &s);
void applyDefaults(
@@ -69,8 +71,18 @@
std::string name() const;
std::vector<std::string> names() const;
+ // The next two methods returns two parts of the FQName, that is,
+ // the first part package + version + name, the second part valueName.
+ FQName typeName() const;
+ std::string valueName() const;
+
bool isFullyQualified() const;
+ // true if:
+ // 1. (package)?(version)?(name):(valueName)
+ // 2. (valueName), aka a single identifier
+ bool isValidValueName() const;
+
void print() const;
std::string string() const;
@@ -126,10 +138,11 @@
std::string getPackageMinorVersion() const;
private:
- bool mValid;
+ bool mValid, mIsIdentifier;
std::string mPackage;
std::string mVersion;
std::string mName;
+ std::string mValueName;
};
} // namespace android