summaryrefslogtreecommitdiffstats
path: root/parameter/EnumValuePair.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2012-02-02 17:12:41 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:15:02 +0100
commit68808c650fc95660c9eb0d8f0bf97701b8076eb8 (patch)
tree57fa617254a8895609a9c17608141b83f263bc2d /parameter/EnumValuePair.cpp
parent0bd50546a8d06a6865d32c695adf8893fa71250a (diff)
downloadexternal_parameter-framework-68808c650fc95660c9eb0d8f0bf97701b8076eb8.zip
external_parameter-framework-68808c650fc95660c9eb0d8f0bf97701b8076eb8.tar.gz
external_parameter-framework-68808c650fc95660c9eb0d8f0bf97701b8076eb8.tar.bz2
PFW: Enum parameter mapping
BZ: 22125 Enum parameter types are now fully parsed as any other types, which allow Mapping attributes to be correctly interpreted. Now inner structure of enum parameter types is based on automatically created objects: ValuePair Slight adaptation of to ICS environment in Android.mk files and XmlComposer (time.h). More explicit error statement issued in case of plugin load failure in SystemClass.cpp. Added a log for Alsa mixer elements accesses. Change-Id: Ia71fd854e639a288c5dae79260b1e2a0eb1a7ac2 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/33756 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/EnumValuePair.cpp')
-rw-r--r--parameter/EnumValuePair.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/parameter/EnumValuePair.cpp b/parameter/EnumValuePair.cpp
new file mode 100644
index 0000000..789d8f9
--- /dev/null
+++ b/parameter/EnumValuePair.cpp
@@ -0,0 +1,75 @@
+/* <auto_header>
+ * <FILENAME>
+ *
+ * INTEL CONFIDENTIAL
+ * Copyright © 2011 Intel
+ * Corporation All Rights Reserved.
+ *
+ * The source code contained or described herein and all documents related to
+ * the source code ("Material") are owned by Intel Corporation or its suppliers
+ * or licensors. Title to the Material remains with Intel Corporation or its
+ * suppliers and licensors. The Material contains trade secrets and proprietary
+ * and confidential information of Intel or its suppliers and licensors. The
+ * Material is protected by worldwide copyright and trade secret laws and
+ * treaty provisions. No part of the Material may be used, copied, reproduced,
+ * modified, published, uploaded, posted, transmitted, distributed, or
+ * disclosed in any way without Intel’s prior express written permission.
+ *
+ * No license under any patent, copyright, trade secret or other intellectual
+ * property right is granted to or conferred upon you by disclosure or delivery
+ * of the Materials, either expressly, by implication, inducement, estoppel or
+ * otherwise. Any license under such intellectual property rights must be
+ * express and approved by Intel in writing.
+ *
+ * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
+ * CREATED: 2011-06-01
+ * UPDATED: 2011-07-27
+ *
+ *
+ * </auto_header>
+ */
+#include "EnumValuePair.h"
+
+#define base CElement
+
+CEnumValuePair::CEnumValuePair() : _iNumerical(0)
+{
+}
+
+// CElement
+string CEnumValuePair::getKind() const
+{
+ return "ValuePair";
+}
+
+// Numerical
+int32_t CEnumValuePair::getNumerical() const
+{
+ return _iNumerical;
+}
+
+string CEnumValuePair::getNumericalAsString() const
+{
+ return toString(_iNumerical);
+}
+
+// From IXmlSink
+bool CEnumValuePair::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+{
+ // Literal
+ setName(xmlElement.getAttributeString("Literal"));
+
+ // Numerical
+ _iNumerical = xmlElement.getAttributeSignedInteger("Numerical");
+
+ // Base
+ return base::fromXml(xmlElement, serializingContext);
+}
+
+// Content dumping
+void CEnumValuePair::logValue(string& strValue, CErrorContext& errorContext) const
+{
+ (void)errorContext;
+ // Convert value
+ strValue = getNumericalAsString();
+}