summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-02-12 07:18:23 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-02-12 07:18:23 +0000
commit5e4143a401129d0025391cfac7a9e7b2434a73e7 (patch)
tree7171a69213b6808d810e99dc19871acdb1486bcb
parent363217cf64f9fdad358b21d2f4bc626dea56a672 (diff)
downloadATCD-5e4143a401129d0025391cfac7a9e7b2434a73e7.tar.gz
Intermediate stuff
-rw-r--r--ACEXML/examples/svcconf/Svcconf_Handler.cpp161
-rw-r--r--ACEXML/examples/svcconf/Svcconf_Handler.h31
-rw-r--r--ACEXML/examples/svcconf/Svcconf_Handler.i14
3 files changed, 195 insertions, 11 deletions
diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.cpp b/ACEXML/examples/svcconf/Svcconf_Handler.cpp
index 18307539f25..279cc4ae978 100644
--- a/ACEXML/examples/svcconf/Svcconf_Handler.cpp
+++ b/ACEXML/examples/svcconf/Svcconf_Handler.cpp
@@ -109,50 +109,50 @@ ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *,
{
if (ACE_OS_String::strcmp (qName, "dynamic") == 0)
{
-
+ this->get_dynamic_attrs (alist, xmlenv);
}
else if (ACE_OS_String::strcmp (qName, "initializer") == 0)
{
-
+ this->get_initializer_attrs (alist, xmlenv);
}
else if (ACE_OS_String::strcmp (qName, "static") == 0)
{
-
+ this->get_static_attrs (alist, xmlenv);
}
else if (ACE_OS_String::strcmp (qName, "stream") == 0)
{
this->get_stream_id (alist, xmlenv);
- // @@ retrieve stream from Service_Repository here.
- return;
+ // @@ retrieve stream service object from Service_Repository here.
}
else if (ACE_OS_String::strcmp (qName, "streamdef") == 0)
{
this->in_stream_def_ = 1;
this->get_stream_id (alist, xmlenv);
- return;
+ // @@ Set up stream service object
}
else if (ACE_OS_String::strcmp (qName, "module") == 0)
{
this->in_module_ = 1;
-
}
else if (ACE_OS_String::strcmp (qName, "resume") == 0)
{
-
+ this->get_id (alist, xmlenv);
}
else if (ACE_OS_String::strcmp (qName, "suspend") == 0)
{
-
+ this->get_id (alist, xmlenv);
}
else if (ACE_OS_String::strcmp (qName, "remove") == 0)
{
-
+ this->get_id (alist, xmlenv);
}
else
{
-
+ // @@ Error. Perhaps we should relay to user event handler here, if available.
}
+ return;
+
if (alist != 0)
for (size_t i = 0; i < alist->getLength (); ++i)
{
@@ -255,3 +255,142 @@ ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist,
}
return 0;
}
+
+int
+ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+{
+ if (alist != 0)
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS_String::strcmp (alist->getQName (i), "id") == 0)
+ {
+ this->parsed_info_.name (alist->getValue (i));
+ }
+ else
+ {
+ // @@ Exception...
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+{
+ if (alist != 0)
+ {
+ ACE_Parsed_Info &info = (this->in_stream_def_ == 0 ?
+ this->parsed_info_ :
+ this->stream_info_);
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS_String::strcmp (alist->getQName (i), "id") == 0)
+ {
+ info.name (alist->getValue (i));
+ }
+ else if (ACE_OS_String::strcmp (alist->getQName (i), "status") == 0)
+ {
+ if (ACE_OS_String::strcmp (alist->getValue (i), "inactive") == 0)
+ {
+ }
+ else if (ACE_OS_String::strcmp (alist->getValue (i), "active") == 0)
+ {
+ }
+ else
+ {
+ // @@ error, invalid 'status' value.
+ }
+ }
+ else if (ACE_OS_String::strcmp (alist->getQName (i), "type") == 0)
+ {
+ if (ACE_OS_String::strcmp (alist->getValue (i), "service_object") == 0)
+ {
+ info.service_type (ACE_Parsed_Info::SERVICE_OBJECT_TYPE);
+ }
+ else if (ACE_OS_String::strcmp (alist->getValue (i), "stream") == 0)
+ {
+ info.service_type (ACE_Parsed_Info::STREAM_TYPE);
+ }
+ else if (ACE_OS_String::strcmp (alist->getValue (i), "module") == 0)
+ {
+ info.service_type (ACE_Parsed_Info::MODULE_TYPE);
+ }
+ else
+ {
+ // @@ error, invalid 'type' value.
+ }
+ }
+ else
+ {
+ // @@ Exception...
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+{
+ if (alist != 0)
+ {
+ ACE_Parsed_Info &info = (this->in_stream_def_ == 0 ?
+ this->parsed_info_ :
+ this->stream_info_);
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS_String::strcmp (alist->getQName (i), "init") == 0)
+ {
+ info.init_func (alist->getValue (i));
+ }
+ else if (ACE_OS_String::strcmp (alist->getQName (i), "path") == 0)
+ {
+ info.path (alist->getValue (i));
+ }
+ else if (ACE_OS_String::strcmp (alist->getQName (i), "params") == 0)
+ {
+ info.init_params (alist->getValue (i));
+ }
+ else
+ {
+ // @@ Exception...
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+{
+ if (alist != 0)
+ {
+ ACE_Parsed_Info &info = (this->in_stream_def_ == 0 ?
+ this->parsed_info_ :
+ this->stream_info_);
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS_String::strcmp (alist->getQName (i), "id") == 0)
+ {
+ info.name (alist->getValue (i));
+ }
+ else if (ACE_OS_String::strcmp (alist->getQName (i), "params") == 0)
+ {
+ info.init_params (alist->getValue (i));
+ }
+ else
+ {
+ // @@ Exception...
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.h b/ACEXML/examples/svcconf/Svcconf_Handler.h
index 080a800eec8..4f9a52feae8 100644
--- a/ACEXML/examples/svcconf/Svcconf_Handler.h
+++ b/ACEXML/examples/svcconf/Svcconf_Handler.h
@@ -41,6 +41,12 @@ public:
Service_Type service_type (void);
/**
+ * Set/Get active status.
+ */
+ int active (int a);
+ int active (void);
+
+ /**
* Set/get initializer path.
*/
int path (const ACEXML_Char *n);
@@ -66,6 +72,7 @@ public:
protected:
ACEXML_Char *name_;
Service_Type service_type_;
+ int active_;
ACEXML_Char *path_;
ACEXML_Char *init_func_;
ACEXML_Char *init_params_;
@@ -277,6 +284,30 @@ protected:
int get_stream_id (ACEXML_Attributes *alist,
ACEXML_Env &xmlenv);
+ /**
+ * Get the only attribute in <resume>, <suspend>, <remove>
+ */
+ int get_id (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv);
+
+ /**
+ * Get the dynamic tag attributes.
+ */
+ int get_dynamic_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv);
+
+ /**
+ * Get the initializer tag attributes.
+ */
+ int get_initializer_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv);
+
+ /**
+ * Get the static tag attributes.
+ */
+ int get_static_attrs (ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv);
+
private:
/// We are parsing a stream definition
int in_stream_def_;
diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.i b/ACEXML/examples/svcconf/Svcconf_Handler.i
index 48038ddf93a..637778485a4 100644
--- a/ACEXML/examples/svcconf/Svcconf_Handler.i
+++ b/ACEXML/examples/svcconf/Svcconf_Handler.i
@@ -4,6 +4,7 @@ ACE_INLINE
ACE_Parsed_Info::ACE_Parsed_Info ()
: name_ (0),
service_type_ (INVALID_TYPE),
+ active_ (1),
path_ (0),
init_func_ (0),
init_params_ (0)
@@ -54,6 +55,19 @@ ACE_Parsed_Info::service_type (void)
}
ACE_INLINE int
+ACE_Parsed_Info::active (int a)
+{
+ this->active_ = a;
+ return 0;
+}
+
+ACE_INLINE int
+ACE_Parsed_Info::active (void)
+{
+ return this->active_;
+}
+
+ACE_INLINE int
ACE_Parsed_Info::path (const ACEXML_Char *p)
{
if (this->path_ == 0)