return aNewClass;
}
+//=======================================================================
+//function : BuildStdMethod
+//purpose :
+//=======================================================================
Handle(MS_MemberMet) MS::BuildStdMethod(const Handle(MS_MemberMet)& aMethod,
const Handle(MS_Class)& aClass,
const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
{
Handle(MS_MemberMet) aNewMethod;
-
+ //
if (!aMethod.IsNull() && !aClass.IsNull()) {
- Standard_Integer i;
+ Standard_Integer i, aNbParams, aNbRaises;
Handle(MS_InstMet) aNewInst;
Handle(MS_Construc) aNewCons;
Handle(MS_ClassMet) aNewCmet;
- MS_InstMet *anInst = 0l;
-
+ MS_InstMet *anInst = NULL;//0l;
+ //
if (aMethod->IsKind(STANDARD_TYPE(MS_InstMet))) {
anInst = (MS_InstMet *)aMethod.operator->();
aNewInst = new MS_InstMet(aMethod->Name(),aClass->FullName());
aNewCmet = new MS_ClassMet(aMethod->Name(),aClass->FullName());
aNewMethod = aNewCmet;
}
-
+ //
// Parameters
//
Handle(MS_HArray1OfParam) aSeqParam = aMethod->Params();
Handle(MS_HSequenceOfParam) tmpParamSeq = new MS_HSequenceOfParam;
if(!aSeqParam.IsNull()) {
- for (i = 1; i <= aSeqParam->Length(); i++) {
+ aNbParams=aSeqParam->Length();
+ for (i = 1; i <= aNbParams; ++i) {
tmpParamSeq->Append(MS::BuildStdParam(aSeqParam->Value(i),aNewMethod,aSeqGen,aSeqType));
- //aNewMethod->Param(MS::BuildStdParam(aSeqParam->Value(i),aNewMethod,aSeqGen,aSeqType));
}
aNewMethod->Params(tmpParamSeq);
}
- // Some attributes
//
+ // Some attributes
aNewMethod->Private(aMethod->Private());
aNewMethod->Inline(aMethod->IsInline());
aNewMethod->ConstReturn(aMethod->IsConstReturn());
aNewMethod->Protected(aMethod->IsProtected());
aNewMethod->FunctionCall(aMethod->IsFunctionCall());
aNewMethod->SetAliasType(aMethod->IsOperator());
-
+ //modified by NIZNHY-PKV Mon May 5 09:09:37 2008f
+ aNewMethod->PtrReturn(aMethod->IsPtrReturn());
+ //modified by NIZNHY-PKV Mon May 5 09:09:40 2008t
+ //
if (!aMethod->Returns().IsNull()) {
aNewMethod->Returns(MS::BuildStdParam(aMethod->Returns(),aNewMethod,aSeqGen,aSeqType));
}
-
+ //
aNewMethod->CreateFullName();
aNewMethod->MetaSchema(aClass->GetMetaSchema());
aClass->GetMetaSchema()->AddMethod(aNewMethod);
-
- // Raises
//
+ // Raises
Handle(TColStd_HSequenceOfHAsciiString) aRaiseSeq = aMethod->GetRaisesName();
Handle(MS_Method) aSimpleMet = aNewMethod;
-
+ //
if(!aRaiseSeq.IsNull()) {
- for (i = 1; i <= aRaiseSeq->Length(); i++) {
+ aNbRaises=aRaiseSeq->Length();
+ for (i = 1; i <= aNbRaises; ++i) {
aSimpleMet->Raises(aRaiseSeq->Value(i));
}
}
cerr << "Error : MS::BuildStdMethod - aMethod or aClass are NULL" << endl;
Standard_NullObject::Raise();
}
-
+ //
return aNewMethod;
}
-
+//
// WARNING (to do) : LikeParam is not copied
//
Handle(MS_Param) MS::BuildStdParam(const Handle(MS_Param)& aParam,
#include <MS_Method.ixx>
#include <MS_MetaSchema.hxx>
#include <MS_InstMet.hxx>
+
#include <Standard_PCharacter.hxx>
#define MET_DESTROY 0x01
#define MET_OPERATOR 0x20
#define MET_FUNCCALL 0x40
#define MET_COMMENT 0x05
-
-MS_Method::MS_Method(const Handle(TCollection_HAsciiString)& aName) : MS_Common(aName),myAttribute(0),myRaises(new TColStd_HSequenceOfHAsciiString),myComment(new TCollection_HAsciiString(""))
+#define MET_PTR 0x80
+
+//=======================================================================
+//function : MS_Method
+//purpose :
+//=======================================================================
+MS_Method::MS_Method(const Handle(TCollection_HAsciiString)& aName)
+:
+ MS_Common(aName),
+ myAttribute(0),
+ myRaises(new TColStd_HSequenceOfHAsciiString),
+ myComment(new TCollection_HAsciiString(""))
{
}
-
+//=======================================================================
+//function : CreateFullName
+//purpose :
+//=======================================================================
void MS_Method::CreateFullName()
{
Standard_Integer i;
FullName(myIdName);
}
-
+//=======================================================================
+//function : Params
+//purpose :
+//=======================================================================
void MS_Method::Params(const Handle(MS_HSequenceOfParam)& params)
{
if(!params.IsNull()) {
//myParam->Append(aParam);
}
+//=======================================================================
+//function : Params
+//purpose :
+//=======================================================================
Handle(MS_HArray1OfParam) MS_Method::Params() const
{
return myParam;
}
+//=======================================================================
+//function : Private
+//purpose :
+//=======================================================================
void MS_Method::Private(const Standard_Boolean aPrivate)
{
if (aPrivate) {
myAttribute &= (myAttribute ^ MET_PRIVATE);
}
}
-
+//=======================================================================
+//function : Private
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::Private() const
{
if (myAttribute & MET_PRIVATE) {
return Standard_False;
}
}
-
+//=======================================================================
+//function : Returns
+//purpose :
+//=======================================================================
void MS_Method::Returns(const Handle(MS_Param)& aParam)
{
myReturns = aParam;
}
+//=======================================================================
+//function : Returns
+//purpose :
+//=======================================================================
Handle(MS_Param) MS_Method::Returns() const
{
return myReturns;
}
+//=======================================================================
+//function : Raises
+//purpose :
+//=======================================================================
void MS_Method::Raises(const Handle(TCollection_HAsciiString)& aRaise)
{
if(myRaises.IsNull()) myRaises = new TColStd_HSequenceOfHAsciiString;
myRaises->Append(aRaise);
}
+//=======================================================================
+//function : GetRaisesName
+//purpose :
+//=======================================================================
Handle(TColStd_HSequenceOfHAsciiString) MS_Method::GetRaisesName() const
{
return myRaises;
}
+//=======================================================================
+//function : Inline
+//purpose :
+//=======================================================================
void MS_Method::Inline(const Standard_Boolean anInline)
{
if (anInline) {
myAttribute &= (MET_INLINE ^ myAttribute);
}
}
-
+//=======================================================================
+//function : IsInline
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsInline() const
{
if (myAttribute & MET_INLINE) {
return Standard_False;
}
}
-
+//=======================================================================
+//function : ConstReturn
+//purpose :
+//=======================================================================
void MS_Method::ConstReturn(const Standard_Boolean aConst)
{
if (aConst) {
myAttribute &= (MET_CONST ^ myAttribute);
}
}
-
+//=======================================================================
+//function : IsConstReturn
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsConstReturn() const
{
if (myAttribute & MET_CONST) {
return Standard_False;
}
}
-
+//=======================================================================
+//function : Alias
+//purpose :
+//=======================================================================
void MS_Method::Alias(const Handle(TCollection_HAsciiString)& anAlias)
{
myAlias = anAlias;
}
-
+//=======================================================================
+//function : IsAlias
+//purpose :
+//=======================================================================
Handle(TCollection_HAsciiString) MS_Method::IsAlias() const
{
return myAlias;
}
-
+//=======================================================================
+//function : RefReturn
+//purpose :
+//=======================================================================
void MS_Method::RefReturn(const Standard_Boolean aRef)
{
if (aRef) {
myAttribute &= (MET_REF ^ myAttribute);
}
}
-
+//=======================================================================
+//function : IsRefReturn
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsRefReturn() const
{
if (myAttribute & MET_REF) {
}
}
+//=======================================================================
+//function : Destructor
+//purpose :
+//=======================================================================
void MS_Method::Destructor(const Standard_Boolean aDestructor)
{
if (aDestructor) {
myAttribute &= (MET_DESTROY ^ myAttribute);
}
}
-
+//=======================================================================
+//function : IsDestructor
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsDestructor() const
{
if (myAttribute & MET_DESTROY) {
return Standard_False;
}
}
-
+//=======================================================================
+//function : FunctionCall
+//purpose :
+//=======================================================================
void MS_Method::FunctionCall(const Standard_Boolean aFunctionCall)
{
if (aFunctionCall) {
myAttribute &= (MET_FUNCCALL ^ myAttribute);
}
}
-
+//=======================================================================
+//function : IsFunctionCall
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsFunctionCall() const
{
if (myAttribute & MET_FUNCCALL) {
return Standard_False;
}
}
-
-Standard_Boolean MS_Method::IsSameSignature(const Handle(TCollection_HAsciiString)& aMetName2) const
+//=======================================================================
+//function : IsSameSignature
+//purpose :
+//=======================================================================
+Standard_Boolean MS_Method::IsSameSignature
+ (const Handle(TCollection_HAsciiString)& aMetName2) const
{
Handle(TCollection_HAsciiString) aMetName1;
Standard_Boolean result = Standard_False;
Standard_PCharacter fin1 = strchr(aname1, '=');
Standard_PCharacter fin2 = strchr(aname2, '=');
- if(fin1) *fin1 = '\0';
- if(fin2) *fin2 = '\0';
-
- //cout << "aname1 : " << aname1 << endl;
- //cout << "aname2 : " << aname2 << endl;
-
+ if(fin1) {
+ *fin1 = '\0';
+ }
+ if(fin2) {
+ *fin2 = '\0';
+ }
+ //
result = !strcmp(aname1, aname2);
-
- //cout << "result : " << result << endl;
-
- if(fin1) *fin1 = '=';
- if(fin2) *fin2 = '=';
-
-// Handle(TCollection_HAsciiString) aname1 = aMetName1->Token(":",2),
-// aname2 = aMetName2->Token(":",2);
-
-// aname1 = aname1->Token("=");
-// aname2 = aname2->Token("=");
-// result = aname1->IsSameString(aname2);
-
+ //
+ if(fin1) {
+ *fin1 = '=';
+ }
+ if(fin2) {
+ *fin2 = '=';
+ }
+ //
if (result) {
- Handle(MS_Method) m1,m2;
+ Handle(MS_Method) m1,m2;
Handle(MS_HArray1OfParam) p1,p2;
m1 = this;
return result;
}
-
+//=======================================================================
+//function : SetAliasType
+//purpose :
+//=======================================================================
void MS_Method::SetAliasType(const Standard_Boolean aType)
{
if (aType) {
myAttribute &= (MET_OPERATOR ^ myAttribute);
}
}
-
+//=======================================================================
+//function : Comment
+//purpose :
+//=======================================================================
Handle(TCollection_HAsciiString) MS_Method::Comment() const
{
- //const Handle(TCollection_HAsciiString)& startComment = new TCollection_HAsciiString("///");
- //if (myComment->IsSameString(startComment)) myComment->Clear();
return myComment;
}
-
+//=======================================================================
+//function : SetComment
+//purpose :
+//=======================================================================
void MS_Method::SetComment(const Handle(TCollection_HAsciiString)& aComment)
{
myComment->AssignCat(aComment);
}
-
+//=======================================================================
+//function : IsOperator
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsOperator() const
{
if (myAttribute & MET_OPERATOR) {
return Standard_False;
}
}
-
+//=======================================================================
+//function : IsQuotedAlias
+//purpose :
+//=======================================================================
Standard_Boolean MS_Method::IsQuotedAlias() const
{
return (!myAlias.IsNull() && !IsOperator());
}
-
+//modified by NIZNHY-PKV Sun May 4 16:20:03 2008f
+//=======================================================================
+//function : PtrReturn
+//purpose :
+//=======================================================================
+void MS_Method::PtrReturn(const Standard_Boolean aFlag)
+{
+ if (aFlag) {
+ myAttribute |= MET_PTR;
+ }
+ else {
+ myAttribute &= (MET_PTR ^ myAttribute);
+ }
+}
+//=======================================================================
+//function : IsPtrReturn
+//purpose :
+//=======================================================================
+Standard_Boolean MS_Method::IsPtrReturn() const
+{
+ if (myAttribute & MET_PTR) {
+ return Standard_True;
+ }
+ else {
+ return Standard_False;
+ }
+}
+//modified by NIZNHY-PKV Sun May 4 16:20:04 2008t