Browse Source

Implementation of visibility field in PARAM.

git-svn-id: https://klish.googlecode.com/svn/trunk@163 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
1779c8d2ad
2 changed files with 21 additions and 1 deletions
  1. 11 0
      clish.xsd
  2. 10 1
      clish/shell/shell_tinyxml_read.cpp

+ 11 - 0
clish.xsd

@@ -244,6 +244,9 @@
 *           the mode of PARAM will be forced to "subcommand". The
 *           feature is implemented to support subcommands with the
 *           same names.
+*
+* [visibility] - define the visibility of the parameter while ${__line}
+*           and ${__params} auto variables expanding.
 ********************************************************
     -->
     <xs:simpleType name="bool_t">
@@ -261,6 +264,13 @@
         </xs:restriction>
     </xs:simpleType>
 
+    <xs:simpleType name="param_visibility_t">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="normal"/>
+            <xs:enumeration value="hidden"/>
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:complexType name="param_t">
         <xs:sequence>
             <xs:element ref="PARAM" minOccurs="0" maxOccurs="unbounded"/>
@@ -272,6 +282,7 @@
         <xs:attribute name="mode" type="param_mode_t" use="optional" default="common"/>
         <xs:attribute name="optional" type="bool_t" use="optional" default="false"/>
         <xs:attribute name="value" type="xs:string" use="optional"/>
+        <xs:attribute name="visibility" type="param_visibility_t" use="optional" default="normal"/>
     </xs:complexType>
     <!--
 ********************************************************

+ 10 - 1
clish/shell/shell_tinyxml_read.cpp

@@ -317,6 +317,7 @@ process_param(clish_shell_t * shell, TiXmlElement * element, void *parent)
 		const char *mode = element->Attribute("mode");
 		const char *optional = element->Attribute("optional");
 		const char *value = element->Attribute("value");
+		const char *visibility = element->Attribute("visibility");
 		clish_param_t *param;
 		clish_ptype_t *tmp = NULL;
 
@@ -395,6 +396,15 @@ process_param(clish_shell_t * shell, TiXmlElement * element, void *parent)
 				CLISH_PARAM_SUBCOMMAND);
 		}
 
+		if (NULL != visibility) {
+			if (!lub_string_nocasecmp(visibility, "hidden"))
+				clish_param__set_visibility(param,
+					CLISH_PARAM_HIDDEN);
+			else
+				clish_param__set_visibility(param,
+					CLISH_PARAM_NORMAL);
+		}
+
 		if (cmd)
 			// add the parameter to the command
 			clish_command_insert_param(cmd, param);
@@ -562,7 +572,6 @@ process_config(clish_shell_t * shell, TiXmlElement * element, void *parent)
 		clish_command__set_seq(cmd, BOOL_TRUE);
 		clish_command__set_seq_num(cmd, seq_num);
 	}
-
 }
 
 ///////////////////////////////////////