GetDeclarationResult GetDeclaration(OdId tObject, GetDeclarationArg tArg)
tObject. Development environment object moniker.
tArg. Operation execution parameters.
The GetDeclaration operation is used to work with code inspector.
The operation is used on working with units. The operation gets information about code inspector that contains the list of all members and types implemented on the unit/assembly. To execute the operation, in the tObject parameter specify moniker of the repository object that is unit or assembly. Object moniker can be obtained on executing the GetObjects operation.
Below is the example of using the GetDeclaration operation to get information about members and types implemented in the unit. The request contains moniker of unit in the repository. The response contains information about members and types. The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"GetDeclaration" :
{
"tObject" :
{
"id" : "S1!M!172002"
},
"tArg" : ""
}
}
{
"GetDeclarationResult" :
{
"result" :
{
"it" :
[
{
"type" : "Module",
"name" : "Collections",
"access" : "Private",
"beginPoint" :
{
"col" : "0",
"row" : "0"
},
"endPoint" :
{
"col" : "0",
"row" : "0"
}
},
{
"type" : "Module",
"name" : "Cubes",
"access" : "Private",
"beginPoint" :
{
"col" : "0",
"row" : "0"
},
"endPoint" :
{
"col" : "0",
"row" : "0"
}
},
{
"type" : "Module",
"name" : "Metabase",
"access" : "Private",
"beginPoint" :
{
"col" : "0",
"row" : "0"
},
"endPoint" :
{
"col" : "0",
"row" : "0"
}
},
{
"type" : "Module",
"name" : "System",
"access" : "Private",
"beginPoint" :
{
"col" : "0",
"row" : "0"
},
"endPoint" :
{
"col" : "0",
"row" : "0"
}
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "Main",
"access" : "Private",
"beginPoint" :
{
"col" : "1",
"row" : "23"
},
"endPoint" :
{
"col" : "13",
"row" : "30"
},
"blocks" :
{
"it" :
{
"type" : "Var",
"moduleName" : "M_ADDITIONAL",
"name" : "obj",
"typeName" : "TestObject",
"access" : "Private",
"beginPoint" :
{
"col" : "5",
"row" : "25"
},
"endPoint" :
{
"col" : "20",
"row" : "25"
},
"isShared" : "0"
}
},
"isShared" : "0"
},
{
"type" : "Class",
"moduleName" : "M_ADDITIONAL",
"name" : "TestObject",
"access" : "Public",
"beginPoint" :
{
"col" : "8",
"row" : "1"
},
"endPoint" :
{
"col" : "21",
"row" : "21"
},
"blocks" :
{
"it" :
[
{
"type" : "Var",
"moduleName" : "M_ADDITIONAL",
"name" : "_arr",
"typeName" : "Array",
"access" : "Private",
"beginPoint" :
{
"col" : "5",
"row" : "2"
},
"endPoint" :
{
"col" : "19",
"row" : "2"
},
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "Create",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "4"
},
"endPoint" :
{
"col" : "27",
"row" : "7"
},
"blocks" : "",
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "CreateWithParams",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "9"
},
"endPoint" :
{
"col" : "37",
"row" : "15"
},
"blocks" :
{
"it" :
[
{
"type" : "Var",
"moduleName" : "M_ADDITIONAL",
"name" : "DefaultValue",
"typeName" : "Double",
"Value" : "0",
"access" : "Public",
"beginPoint" :
{
"col" : "56",
"row" : "9"
},
"endPoint" :
{
"col" : "80",
"row" : "9"
},
"isShared" : "0"
},
{
"type" : "Var",
"moduleName" : "M_ADDITIONAL",
"name" : "Size",
"typeName" : "Integer",
"access" : "Public",
"beginPoint" :
{
"col" : "41",
"row" : "9"
},
"endPoint" :
{
"col" : "54",
"row" : "9"
},
"isShared" : "0"
}
]
},
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "Run",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "17"
},
"endPoint" :
{
"col" : "16",
"row" : "20"
},
"blocks" : "",
"isShared" : "0"
}
]
}
}
]
}
}
}
public static GetDeclarationResult GetDeclaration(MbId mb, string objId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tGet = new GetDeclaration()
{
tArg = new GetDeclarationArg(),
//Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, objId).k }
};
//Get information from code inspector
var result = somClient.GetDeclaration(tGet);
return result;
}
See also: