aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-12-15 14:30:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-12-15 14:30:43 +0200
commitb3af9aa74169dc35cddfe0f08104d650e43d38b7 (patch)
tree2fc20508ffd845075286b164542dbb978266b100
parentaf83df9be50a9383d0c54fb24b8e486a658a2a02 (diff)
Explicitly create an ultimate base instance for default/fixed values
-rw-r--r--tests/cxx/tree/default/general/test.xsd6
-rw-r--r--xsd/cxx/tree/default-value.cxx55
2 files changed, 35 insertions, 26 deletions
diff --git a/tests/cxx/tree/default/general/test.xsd b/tests/cxx/tree/default/general/test.xsd
index e9a3bcb..f5bca49 100644
--- a/tests/cxx/tree/default/general/test.xsd
+++ b/tests/cxx/tree/default/general/test.xsd
@@ -77,6 +77,10 @@
<!-- date/time types -->
+ <simpleType name="date-derived">
+ <restriction base="date"/>
+ </simpleType>
+
<complexType name="date-test">
<attribute default="2009-03-31" name="a" type="date"/>
<attribute default="2009-03-31Z" name="b" type="date"/>
@@ -84,7 +88,7 @@
<attribute default="2009-03-31-00:00" name="d" type="date"/>
<attribute default="2009-03-31+12:30" name="e" type="date"/>
<attribute default="2009-03-31-12:30" name="f" type="date"/>
- <attribute default="2002009-03-31-12:30" name="g" type="date"/>
+ <attribute default="2002009-03-31-12:30" name="g" type="t:date-derived"/>
</complexType>
<complexType name="time-test">
diff --git a/xsd/cxx/tree/default-value.cxx b/xsd/cxx/tree/default-value.cxx
index ee39931..ba74b2a 100644
--- a/xsd/cxx/tree/default-value.cxx
+++ b/xsd/cxx/tree/default-value.cxx
@@ -577,7 +577,7 @@ namespace CXX
// Date/time.
//
Void InitValue::
- traverse (SemanticGraph::Fundamental::Date&)
+ traverse (SemanticGraph::Fundamental::Date& t)
{
// date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM]
//
@@ -597,13 +597,13 @@ namespace CXX
strip_zeros (month);
strip_zeros (day);
- os << year << ", " << month << ", " << day;
-
+ os << fq_name (t) << " (" << year << ", " << month << ", " << day;
time_zone (b + 2);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::DateTime&)
+ traverse (SemanticGraph::Fundamental::DateTime& t)
{
// date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM]
//
@@ -645,10 +645,11 @@ namespace CXX
strip_zeros (seconds);
make_float (seconds);
- os << year << ", " << month << ", " << day << ", "
+ os << fq_name (t) << " ("
+ << year << ", " << month << ", " << day << ", "
<< hours << ", " << minutes << ", " << seconds;
-
time_zone (e);
+ os << ")";
}
namespace
@@ -670,7 +671,7 @@ namespace CXX
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::Duration&)
+ traverse (SemanticGraph::Fundamental::Duration& t)
{
// duration := [-]P[nY][nM][nD][TnHnMn[.n+]S]
//
@@ -678,6 +679,8 @@ namespace CXX
Size b (1), e, n (value_.size ());
+ os << fq_name (t) << " (";
+
if (value_[0] == '-')
{
os << "true, ";
@@ -766,10 +769,12 @@ namespace CXX
}
else
os << "0.0";
+
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::Day&)
+ traverse (SemanticGraph::Fundamental::Day& t)
{
// gday := ---DD[Z|(+|-)HH:MM]
//
@@ -778,13 +783,13 @@ namespace CXX
String day (value_, 3, 2);
strip_zeros (day);
- os << day;
-
+ os << fq_name (t) << " (" << day;
time_zone (5);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::Month&)
+ traverse (SemanticGraph::Fundamental::Month& t)
{
// gmonth := --MM[Z|(+|-)HH:MM]
//
@@ -793,13 +798,13 @@ namespace CXX
String month (value_, 2, 2);
strip_zeros (month);
- os << month;
-
+ os << fq_name (t) << " (" << month;
time_zone (4);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::MonthDay&)
+ traverse (SemanticGraph::Fundamental::MonthDay& t)
{
// gmonth_day := --MM-DD[Z|(+|-)HH:MM]
//
@@ -811,13 +816,13 @@ namespace CXX
strip_zeros (month);
strip_zeros (day);
- os << month << ", " << day;
-
+ os << fq_name (t) << " (" << month << ", " << day;
time_zone (7);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::Year&)
+ traverse (SemanticGraph::Fundamental::Year& t)
{
// gyear := [-]CCYY[N]*[Z|(+|-)HH:MM]
//
@@ -835,13 +840,13 @@ namespace CXX
String year (value_, 0, pos);
strip_zeros (year);
- os << year;
-
+ os << fq_name (t) << " (" << year;
time_zone (pos);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::YearMonth&)
+ traverse (SemanticGraph::Fundamental::YearMonth& t)
{
// gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM]
//
@@ -855,13 +860,13 @@ namespace CXX
strip_zeros (year);
strip_zeros (month);
- os << year << ", " << month;
-
+ os << fq_name (t) << " (" << year << ", " << month;
time_zone (pos + 3);
+ os << ")";
}
Void InitValue::
- traverse (SemanticGraph::Fundamental::Time&)
+ traverse (SemanticGraph::Fundamental::Time& t)
{
// time := HH:MM:SS[.S+][Z|(+|-)HH:MM]
//
@@ -886,9 +891,9 @@ namespace CXX
strip_zeros (seconds);
make_float (seconds);
- os << hours << ", " << minutes << ", " << seconds;
-
+ os << fq_name (t) << " (" << hours << ", " << minutes << ", " << seconds;
time_zone (e);
+ os << ")";
}
Void InitValue::