diff options
author | Michi Henning <michi@zeroc.com> | 2006-02-14 04:16:41 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2006-02-14 04:16:41 +0000 |
commit | 761ef1f4ddf4069f702ec99c377faa2d7b2a0694 (patch) | |
tree | 14a6c6a715b962043cfb3cbe5807f28714335a6d /cpp | |
parent | Bug 853. (diff) | |
download | ice-761ef1f4ddf4069f702ec99c377faa2d7b2a0694.tar.bz2 ice-761ef1f4ddf4069f702ec99c377faa2d7b2a0694.tar.xz ice-761ef1f4ddf4069f702ec99c377faa2d7b2a0694.zip |
Changed slice2cs and slice2vb to allow "clr:property" for all structs. It's
more consistent that way.
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/src/Slice/CsUtil.cpp | 9 | ||||
-rwxr-xr-x | cpp/src/Slice/VbUtil.cpp | 9 | ||||
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 16 | ||||
-rwxr-xr-x | cpp/src/slice2vb/Gen.cpp | 16 |
4 files changed, 26 insertions, 24 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index b1bc74d704a..b94c40fc752 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -1061,15 +1061,6 @@ bool Slice::CsGenerator::MetaDataVisitor::visitStructStart(const StructPtr& p) { validate(p); - if(p->hasMetaData("clr:property")) - { - if(!p->hasMetaData("clr:class")) - { - string file = p->definitionContext()->filename(); - cout << file << ":" << p->line() << ": warning: the property mapping applies to Slice " - << "structures only in conjunction with the `clr:class' metadata directive" << endl; - } - } return true; } diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp index 4894958b78b..c4e75a80fac 100755 --- a/cpp/src/Slice/VbUtil.cpp +++ b/cpp/src/Slice/VbUtil.cpp @@ -1109,15 +1109,6 @@ bool Slice::VbGenerator::MetaDataVisitor::visitStructStart(const StructPtr& p) { validate(p); - if(p->hasMetaData("clr:property")) - { - if(!p->hasMetaData("clr:class")) - { - string file = p->definitionContext()->filename(); - cout << file << ":" << p->line() << ": warning: the property mapping applies to Slice " - << "structures only in conjunction with the `clr:class' metadata directive" << endl; - } - } return true; } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index e87a4691bce..753070d6296 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -2982,11 +2982,16 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) int baseTypes = 0; bool isClass = false; bool propertyMapping = false; + bool isValue = false; ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); assert(cont); - if(StructPtr::dynamicCast(cont) && cont->hasMetaData("clr:class")) + if(StructPtr::dynamicCast(cont)) { - baseTypes = DotNet::ICloneable; + isValue = isValueType(StructPtr::dynamicCast(cont)); + if(!isValue || cont->hasMetaData("clr:class")) + { + baseTypes = DotNet::ICloneable; + } if(cont->hasMetaData("clr:property")) { propertyMapping = true; @@ -3023,7 +3028,12 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) return; } - _out << nl << "public virtual " << type << ' ' << propertyName; + _out << nl << "public"; + if(!isValue) + { + _out << " virtual"; + } + _out << ' ' << type << ' ' << propertyName; _out << sb; _out << nl << "get"; _out << sb; diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 2568b0283f2..e9007cb2130 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -3255,11 +3255,16 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) int baseTypes = 0; bool isClass = false; bool propertyMapping = false; + bool isValue = false; ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); assert(cont); - if(StructPtr::dynamicCast(cont) && cont->hasMetaData("clr:class")) + if(StructPtr::dynamicCast(cont)) { - baseTypes = DotNet::ICloneable; + isValue = isValueType(StructPtr::dynamicCast(cont)); + if(!isValue || cont->hasMetaData("clr:class")) + { + baseTypes = DotNet::ICloneable; + } if(cont->hasMetaData("clr:property")) { propertyMapping = true; @@ -3297,7 +3302,12 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) return; } - _out << nl << "Public Overridable Property " << propertyName << " As " << type; + _out << nl << "Public"; + if(!isValue) + { + _out << " Overridable"; + } + _out << " Property " << propertyName << " As " << type; _out.inc(); _out << nl << "Get"; _out.inc(); |