[GME-commit] GMESRC/Paradigms/MetaGME/BonExtension8 BonXtender8.vcproj, NONE, 1.1 CompIcon.ico, NONE, 1.1 Component.rc, NONE, 1.1 ComponentConfig.h, NONE, 1.1 Console.cpp, NONE, 1.1 Console.h, NONE, 1.1 Engine.cpp, NONE, 1.1 Globals.h, NONE, 1.1 LogStream.cpp, NONE, 1.1 LogStream.h, NONE, 1.1 RawComponent.cpp, NONE, 1.1 RawComponent.h, NONE, 1.1 Regexp.cpp, NONE, 1.1 Regexp.h, NONE, 1.1 Resource.h, NONE, 1.1 StdAfx.cpp, NONE, 1.1 StdAfx.h, NONE, 1.1 component.def, NONE, 1.1 entity.h, NONE, 1.1 logger.cpp, NONE, 1.1 logger.h, NONE, 1.1 myutil.cpp, NONE, 1.1 myutil.h, NONE, 1.1 relation.cpp, NONE, 1.1 relation.h, NONE, 1.1
Log messages of CVS commits
gme-commit at list.isis.vanderbilt.edu
Fri Mar 14 16:13:51 CDT 2008
- Previous message: [GME-commit] GMESRC/Paradigms/MetaGME/BonExtension8/Gui - New directory
- Next message: [GME-commit] GMESRC/Paradigms/MetaGME/BonExtension8/Gui InPlaceEdit.cpp, NONE, 1.1 InPlaceEdit.h, NONE, 1.1 InPlaceList.cpp, NONE, 1.1 InPlaceList.h, NONE, 1.1 OptionsDlg.cpp, NONE, 1.1 OptionsDlg.h, NONE, 1.1 SelConf.cpp, NONE, 1.1 SelConf.h, NONE, 1.1 Table.cpp, NONE, 1.1 Table.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension8
In directory escher:/tmp/cvs-serv28536
Added Files:
BonXtender8.vcproj CompIcon.ico Component.rc ComponentConfig.h
Console.cpp Console.h Engine.cpp Globals.h LogStream.cpp
LogStream.h RawComponent.cpp RawComponent.h Regexp.cpp
Regexp.h Resource.h StdAfx.cpp StdAfx.h component.def entity.h
logger.cpp logger.h myutil.cpp myutil.h relation.cpp
relation.h
Log Message:
Rawcomponent implementation of BonXtender.
CVS User: Zoltan Molnar, ISIS (zolmol)
--- NEW FILE: Regexp.cpp ---
// Win32 porting notes.
#if defined( _MBCS )
#pragma message( __FILEINFO__ "This code is broken under _MBCS, " \
"see the comments at the top of this file." )
#endif //_MBCS
//
//
// In case this isn't obvious from the later comments this is an ALTERED
// version of the software. If you like my changes then cool, but nearly
// all of the functionality here is derived from Henry Spencer's original
// work.
//
// This code should work correctly under both _SBCS and _UNICODE, I did
// start working on making it work with _MBCS but gave up after a while
// since I don't need this particular port and it's not going to be as
// straight forward as the other two.
//
// The problem stems from the compiled program being stored as TCHARS,
[...1702 lines suppressed...]
}
szReplace.ReleaseBuffer( replacelen );
return szReplace;
}
CString Regexp::GetErrorString() const
{
// make sure that if status == 0 that we have an error string
ASSERT( ( ! CompiledOK() ) ? ( rc ? rc->GetErrorString() : m_szError).GetLength() != 0 : 1 );
return rc ? rc->GetErrorString() : m_szError ;
}
void Regexp::ClearErrorString() const
{
if ( rc )
rc->ClearErrorString();
m_szError.Empty();
}
--- NEW FILE: myutil.cpp ---
#pragma once
#include "stdafx.h"
#include <string>
#include "ComponentLib.h"
#include "GMECOM.h"
#include "Console.h"
//interface IMgaFCO;
//interface IMgaFolder;
//interface IMgaProject;
namespace Util
{
CComBSTR Copy( const std::string& str )
{
return ( str.empty() ) ? CComBSTR() : CComBSTR( str.c_str() );
}
std::string Copy( const CComBSTR& bstr )
{
CString str( bstr );
std::string strResult( str.GetBuffer( str.GetLength() ) );
str.ReleaseBuffer();
return strResult;
}
std::string CopyV( const CComVariant& v)
{
if (v.vt != (VT_UI1 | VT_ARRAY) ||
v.parray == NULL ||
v.parray->cbElements != 1 ||
v.parray->cDims != 1 ||
v.parray->rgsabound[0].cElements != sizeof(GUID))
{
ASSERT( 0);
return "";
}
GUID guid;
unsigned char *start = (unsigned char*)&guid;
unsigned char *end = (unsigned char*)(&guid+1);
const unsigned char *q = NULL;
COMTHROW( SafeArrayAccessData(v.parray, (void**)&q) );
if (q == NULL ) {
ASSERT( 0);
return "";
}
memcpy( start, q, (end - start) * sizeof(unsigned char) );
COMTHROW( SafeArrayUnaccessData(v.parray) );
wchar_t *guidstr = NULL;
COMTHROW(StringFromCLSID(guid,&guidstr));
std::string result = Util::Copy( guidstr );
CoTaskMemFree(guidstr);
return result;
}
std::string gvbp( IMgaRegNode* p_rn, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try
{
CComBSTR rv;
CComPtr<IMgaRegNode> subn;
COMTHROW( p_rn->get_SubNodeByName( Util::Copy( p_path), &subn));
COMTHROW( subn->get_Value( &rv));
return Util::Copy( rv);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with gvbp() with path " + p_path, MSG_ERROR);
throw;
}
}
void svbp( IMgaRegNode* p_rn, const std::string& p_path, const std::string& p_value)
{
ASSERT( p_path.substr( 0, 1) != "/");
try
{
CComPtr<IMgaRegNode> subn;
COMTHROW( p_rn->get_SubNodeByName( Util::Copy( p_path), &subn));
COMTHROW( subn->put_Value( Util::Copy( p_value)));
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with svbp() with path " + p_path, MSG_ERROR);
throw;
}
}
std::string getReg( IMgaFolder* ptr, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
CComBSTR val;
COMTHROW( ptr->get_RegistryValue( Copy( p_path), &val));
return Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
std::string getReg( IMgaFCO* ptr, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
CComBSTR val;
COMTHROW( ptr->get_RegistryValue( Copy( p_path), &val));
return Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
void setReg( IMgaFCO* ptr, const std::string& p_path, const std::string& p_value)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
COMTHROW( ptr->put_RegistryValue( Copy( p_path), Copy( p_value)));
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
bool islibobj( IMgaObject* p_ptr)
{
try
{
VARIANT_BOOL vb = VARIANT_FALSE;
if( p_ptr) COMTHROW( p_ptr->get_IsLibObject( &vb));
return vb == VARIANT_TRUE; // element's parent is in a library?
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with isliboj()", MSG_ERROR);
throw;
}
}
bool isproxy( IMgaFCO* p_ptr)
{
try
{
CComPtr<IMgaMetaFCO> meta;
if( p_ptr) COMTHROW( p_ptr->get_Meta( &meta));
CComBSTR b_kind;
if( meta) COMTHROW( meta->get_Name( &b_kind));
std::string kind = Util::Copy( b_kind);
return kind.find( "Proxy") != std::string::npos;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with isproxy()", MSG_ERROR);
throw;
}
}
std::string name( IMgaObject* ptr)
{
try
{
CComBSTR nm;
if( ptr) COMTHROW( ptr->get_Name( &nm));
return Util::Copy( nm);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with name()", MSG_ERROR);
throw;
}
}
std::string name( IMgaFCO* ptr)
{
try
{
CComBSTR nm;
if( ptr) COMTHROW( ptr->get_Name( &nm));
return Util::Copy( nm);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with name()", MSG_ERROR);
throw;
}
}
std::string kind( IMgaObject* p_ptr)
{
try
{
CComPtr<IMgaMetaBase> meta;
if( p_ptr) COMTHROW( p_ptr->get_MetaBase( &meta));
CComBSTR b_kind;
if( meta) COMTHROW( meta->get_Name( &b_kind));
return Util::Copy( b_kind);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with kind()", MSG_ERROR);
throw;
}
}
std::string getStrAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
CComBSTR val;
COMTHROW( p_ptr->get_StrAttrByName( Copy( p_attrName), &val));
return Util::Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getStrAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
bool getBoolAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
VARIANT_BOOL vb;
COMTHROW( p_ptr->get_BoolAttrByName( Copy( p_attrName), &vb));
return vb == VARIANT_TRUE;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getBoolAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
long getLongAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
long val;
COMTHROW( p_ptr->get_IntAttrByName( Copy( p_attrName), &val));
return val;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getLongAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
IMgaAttribute* getAttrib( IMgaFCO* p_fco, const std::string& p_attrName)
{
CComBSTR attr_name = Util::Copy( p_attrName);
CComPtr<IMgaAttribute> found_attr = 0;
CComPtr<IMgaMetaAttribute> found_meta_attr = 0;
// property Status of definition: 0: here, -1: in meta, >=1: inherited, -2: undefined")]
CComPtr<IMgaAttributes> attrs;
COMTHROW( p_fco->get_Attributes( &attrs));
long c = 0;
if( attrs) COMTHROW( attrs->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaAttribute> item;
COMTHROW( attrs->get_Item( i, &item));
CComPtr<IMgaMetaAttribute> meta_attr;
if( item) COMTHROW( item->get_Meta( &meta_attr));
CComBSTR nm;
if( meta_attr) COMTHROW( meta_attr->get_Name( &nm));
if( attr_name == nm)
{
found_attr = item;
found_meta_attr = meta_attr;
break;
}
}
return found_attr;
}
bool isAttrStatHere( IMgaFCO* p_fco, const std::string& p_attrName)
{
try
{
CComBSTR attr_name = Util::Copy( p_attrName);
CComPtr<IMgaAttribute> found_attr = 0;
CComPtr<IMgaMetaAttribute> found_meta_attr = 0;
// property Status of definition: 0: here, -1: in meta, >=1: inherited, -2: undefined")]
CComPtr<IMgaAttributes> attrs;
COMTHROW( p_fco->get_Attributes( &attrs));
long c = 0;
if( attrs) COMTHROW( attrs->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaAttribute> item;
COMTHROW( attrs->get_Item( i, &item));
CComPtr<IMgaMetaAttribute> meta_attr;
if( item) COMTHROW( item->get_Meta( &meta_attr));
CComBSTR nm;
if( meta_attr) COMTHROW( meta_attr->get_Name( &nm));
if( attr_name == nm)
{
found_attr = item;
found_meta_attr = meta_attr;
break;
}
}
ASSERT( found_attr);
if( !found_attr)
return false;
long stat = -2;
COMTHROW( found_attr->get_Status( &stat));
return stat >= 0;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed in isAttrStatHere with attribute " + p_attrName + " on " + Util::name( p_fco), MSG_ERROR);
throw;
}
}
std::string composePath( IMgaObject * ptr, bool p_upUntilFolders) // should produce an output like: SF/OutputSignal
{
CComPtr<IMgaObject> cur = ptr;
try
{
std::string path;
while( cur)
{
if( !path.empty())
path.insert( 0, '/');
std::string nm = Util::name( cur);
path.insert( 0, nm.c_str());
CComPtr<IMgaObject> parent;
objtype_enum ot;
COMTHROW( cur->GetParent( &parent, &ot));
cur = parent;
if( p_upUntilFolders && ot == OBJTYPE_FOLDER)
cur = 0;
}
return path;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with composePath()", MSG_ERROR);
throw;
}
}
}
--- NEW FILE: CompIcon.ico ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Engine.cpp ---
#include "stdafx.h"
#include "RawComponent.h"
#include "logger.h"
#include <string>
#include "Dumper.h"
#include "globals.h"
extern Globals global_vars;
void RawComponent::entityBuilder( IMgaModel* model, IMgaFolder* parent)
{
CComPtr<IMgaFCOs> children;
COMTHROW( model->get_ChildFCOs( &children));
long c = 0;
if( children) COMTHROW( children->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
[...1612 lines suppressed...]
{
if (rel_it1->getOperation() == Relation::HAS_ATTRIBUTE_OP &&
rel_it2->getOperation() == Relation::HAS_ATTRIBUTE_OP )
{
//CHECK if the same attribute is contained twice by the FCO
if ( rel_it1->getOp1() == rel_it2->getOp1()
&& rel_it1->getOp2() == rel_it2->getOp2()
&& rel_it1 != rel_it2)
{
ObjPointer o1 = rel_it1->getOp1();
ObjPointer o2 = rel_it1->getOp2();
global_vars.err << "Internal error: Same attribute " << Util::name( o2) <<
" contained twice by " << Util::name( o1) << "\n";
}
}
}
}
#endif
}
--- NEW FILE: relation.h ---
#ifndef RELATION_H
#define RELATION_H
#include "string"
#include "Myutil.h"
class Relation
{
public:
// basic relations
static const std::string containment_str;//"Containment"
static const std::string folder_containment_str;//"FolderContainment"
static const std::string set_membership_str;//"SetMembership"
static const std::string refer_to_str;//"ReferTo"
static const std::string has_aspect_str;//"HasAspect"
static const std::string aspect_member_str;//"AspectMember"
static const std::string has_constraint_str;//"HasConstraint"
static const std::string has_attribute_str;//"HasAttribute"
// complex relations
static const std::string connector_str;//("Connector");
static const std::string connector_src;//("SourceToConnector");
static const std::string connector_dst;//("ConnectorToDestination");
static const std::string connector_descr;//("AssociationClass");
static const std::string equivalence_str;//("Equivalence");
static const std::string equivalence_right;//("EquivRight");
static const std::string equivalence_left;//("EquivLeft");
static const std::string inheritance_str;//("Inheritance");
static const std::string inheritance_base;//("BaseInheritance");
static const std::string inheritance_derived;//("DerivedInheritance");
static const std::string int_inheritance_str;//("InterfaceInheritance");
static const std::string int_inheritance_base;//("BaseIntInheritance");
static const std::string int_inheritance_derived;//("DerivedIntInheritance");
static const std::string imp_inheritance_str;//("ImplementationInheritance");
static const std::string imp_inheritance_base;//("BaseImpInheritance");
static const std::string imp_inheritance_derived;//("DerivedImpInheritance");
static const std::string same_folder_str;//("SameFolder");
static const std::string same_folder_right;//("SameFolderRight");
static const std::string same_folder_left;//("SameFolderLeft");
static const std::string same_aspect_str;//("SameAspect");
static const std::string same_aspect_right;//("SameAspectRight");
static const std::string same_aspect_left;//("SameAspectLeft");
typedef enum
{
// connections which make direct relationship
CONTAINMENT_OP,
FOLDER_CONTAINMENT_OP,
SET_MEMBER_OP,
REFER_TO_OP,
HAS_ASPECT_OP,
ASPECT_MEMBER_OP,
HAS_CONSTRAINT_OP,
HAS_ATTRIBUTE_OP,
// connections which establish indirect relationship
ASSOCIATION_OP, // replaces CONNECTOR
EQUIVALENCE_OP, // replaces EquivLeft, EquivRight // elim
INHERITANCE_OP,
INT_INHERITANCE_OP,
IMP_INHERITANCE_OP,
SAME_FOLDER_OP, // elim
SAME_ASPECT_OP // elim
} OPER_TYPE;
inline std::string getOperationStr() const {
const std::string strings[] = {
"CONTAINMENT_OP",
"FOLDER_CONTAINMENT_OP",
"SET_MEMBER_OP",
"REFER_TO_OP",
"HAS_ASPECT_OP",
"ASPECT_MEMBER_OP",
"HAS_CONSTRAINT_OP",
"HAS_ATTRIBUTE_OP",
"ASSOCIATION_OP",
"EQUIVALENCE_OP",
"INHERITANCE_OP",
"INT_INHERITANCE_OP",
"IMP_INHERITANCE_OP",
"SAME_FOLDER_OP",
"SAME_ASPECT_OP"
};
return strings[m_operation];
}
inline OPER_TYPE getOperation() { return m_operation; }
inline IMgaFCO* getOp1() { return m_operand1; }
inline IMgaFCO* getOp2() { return m_operand2; }
inline IMgaFCO* getOp3() { return m_operand3; }
inline IMgaFCO* getOp4() { return m_operand4; }
inline IMgaFCO* getOp5() { return m_operand5; }
inline void setOperation( OPER_TYPE oper_t) { m_operation = oper_t; }
inline void setOp1(IMgaFCO* op_1) { m_operand1 = op_1; }
inline void setOp2(IMgaFCO* op_2) { m_operand2 = op_2; }
inline void setOp3(IMgaFCO* op_3) { m_operand3 = op_3; }
inline void setOp4(IMgaFCO* op_4) { m_operand4 = op_4; }
inline void setOp5(IMgaFCO* op_5) { m_operand5 = op_5; }
explicit Relation(
OPER_TYPE oper_t,
IMgaFCO* operd1 = (IMgaFCO*)0,
IMgaFCO* operd2 = (IMgaFCO*)0,
IMgaFCO* operd3 = (IMgaFCO*)0,
IMgaFCO* operd4 = (IMgaFCO*)0,
IMgaFCO* operd5 = (IMgaFCO*)0)
: m_operation( oper_t),
m_operand1( operd1),
m_operand2( operd2),
m_operand3( operd3),
m_operand4( operd4),
m_operand5( operd5) { };
~Relation() { }
Relation( const Relation & operand):
m_operation( operand.m_operation),
m_operand1( operand.m_operand1),
m_operand2( operand.m_operand2),
m_operand3( operand.m_operand3),
m_operand4( operand.m_operand4),
m_operand5( operand.m_operand5) { };
const Relation & operator=(const Relation & operand)
{
if ( this == &operand) return *this;
m_operation = operand.m_operation;
m_operand1 = operand.m_operand1;
m_operand2 = operand.m_operand2;
m_operand3 = operand.m_operand3;
m_operand4 = operand.m_operand4;
m_operand5 = operand.m_operand5;
return *this;
}
bool operator==( const Relation& peer)
{
return (m_operation==peer.m_operation) &&
(m_operand1 == peer.m_operand1) &&
(m_operand2 == peer.m_operand2) &&
(m_operand3 == peer.m_operand3) &&
(m_operand4 == peer.m_operand4) &&
(m_operand5 == peer.m_operand5);
}
bool operator<( const Relation& peer) const
{
if ( m_operation != peer.m_operation) return m_operation < peer.m_operation;
int k;
k = Util::name( m_operand1).compare( Util::name( peer.m_operand1));
if( k != 0) return k < 0;
k = Util::name( m_operand2).compare( Util::name( peer.m_operand2));
if( k != 0) return k < 0;
k = Util::name( m_operand3).compare( Util::name( peer.m_operand3));
return ( k < 0);
}
private:
OPER_TYPE m_operation;
IMgaFCO* m_operand1;
IMgaFCO* m_operand2;
IMgaFCO* m_operand3;
IMgaFCO* m_operand4;
IMgaFCO* m_operand5;
};
#endif //RELATION_H
--- NEW FILE: LogStream.h ---
#ifndef LOGSTREAM_H
#define LOGSTREAM_H
#include <fstream>
#include <string>
#include "MyUtil.h"
class LogStream : public std::ofstream
{
public:
LogStream();
~LogStream();
void flushit();
// friend put-to operators
friend LogStream& operator<<( LogStream& s, msgtype_enum msgtype);
friend LogStream& operator<<( LogStream& s, IMgaFCO* fco);
friend LogStream& operator<<( LogStream& s, const char * r);
friend LogStream& operator<<( LogStream& s, const std::string& r);
friend LogStream& operator<<( LogStream& s, const int i);
CComPtr<IMgaProject> m_proj;
msgtype_enum m_msgtype;
std::string m_buff;
};
#endif //LOGSTREAM_H
--- NEW FILE: Console.h ---
#pragma once
#include "ComponentLib.h"
#include <string>
class Console
{
typedef CComPtr<IGMEOLEApp> GMEAppPtr;
GMEAppPtr m_gme;
public:
Console(void);
~Console(void);
GMEAppPtr getGME( IMgaProject* project);
void init( IMgaProject* project);
void sendMsg( const std::string& p_msg, msgtype_enum p_type);
static ssendMsg( const std::string& p_msg, msgtype_enum p_type);
};
--- NEW FILE: StdAfx.cpp ---
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#if _ATL_VER < 0x0700
#include <statreg.cpp>
#endif // _ATL_VER < 0x0700
#endif // _ATL_STATIC_REGISTRY
#if _ATL_VER < 0x0700
#include <atlimpl.cpp>
#endif // _ATL_VER < 0x0700
--- NEW FILE: StdAfx.h ---
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_)
#define AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#include <afxwin.h>
#include <afxdisp.h>
#include <algorithm>
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED)
--- NEW FILE: Regexp.h ---
#ifndef __REGEXP_H__
#define __REGEXP_H__
//class CString;
class regexp;
class Regexp
{
public:
enum { NSUBEXP = 10 };
Regexp();
Regexp( LPCTSTR exp, BOOL iCase = 0 );
Regexp( const Regexp &r );
~Regexp();
const Regexp & operator=( const Regexp & r );
bool Match( const TCHAR * s );
int SubStrings() const;
const CString operator[]( unsigned int i ) const;
int SubStart( unsigned int i ) const;
int SubLength( unsigned int i ) const;
CString GetReplaceString( LPCTSTR source ) const;
CString GetErrorString() const;
bool CompiledOK() const;
#if defined( _RE_DEBUG )
void Dump();
#endif
private:
const TCHAR * string; /* used to return substring offsets only */
mutable CString m_szError;
regexp * rc;
void ClearErrorString() const;
int safeIndex( unsigned int i ) const;
};
#endif
--- NEW FILE: logger.cpp ---
#include "stdafx.h"
#include "logger.h"
#include "string"
#include "algorithm"
#include "globals.h"
extern Globals global_vars;
bool existsFile( const char * src_name)
{
std::ifstream input_file( src_name, std::ios_base::in);
if ( !input_file.is_open())
return false;
input_file.close();
return true;
}
int makeFileCopy( const char * src_name, const char * dst_name)
{
char buff[4096];
std::ifstream input_file( src_name, std::ios_base::in);
std::ofstream output_file( dst_name, std::ios_base::out);
if ( !input_file.is_open())
return 2;
if ( !output_file.is_open())
return 3;
while ( !input_file.eof())
{
input_file.read( buff, 4096);
output_file.write( buff, input_file.gcount());
}
input_file.close();
output_file.close();
return 1;
}
int makeFileMove( const char * src_name, const char * dst_name)
{
if( !fileExists( src_name)) return 1; // src nonexistent, done
BOOL dres = TRUE;
if( fileExists( dst_name)) // exists and not read only
{
dres = DeleteFile( dst_name); // must delete before move
}
if( !dres) return 0; // failure?, move won't succeed, return
// either dst didn't exist or successful deletion
dres = MoveFile( src_name, dst_name);
return dres == TRUE? 1: 0;
}
bool fileExists( const char * file)
{
bool res = false;
CFileStatus stat;
if( file // not-empty string
&& CFile::GetStatus( file, stat)) // status fetched succesfully
{
if( (stat.m_attribute & CFile::directory) == 0 // it is NOT a directory
&& (stat.m_attribute & CFile::readOnly) == 0) // not read only
{
res = true;
}
}
return res;
}
std::string shortFileName( const std::string& long_name)
{
int pos = long_name.rfind( '\\');
if ( pos != std::string::npos)
{
std::string short_name;
if ( pos + 1 < long_name.length())
short_name = long_name.substr( pos + 1);
else
short_name = "insert_your_specialized_header_filename_here.h";
return short_name;
}
return long_name;
}
std::string cutExtension( const std::string& filename)
{
int p = filename.rfind( ".");
if ( p != std::string::npos)
return filename.substr( 0, p);
return filename;
}
std::string capitalizeString( const std::string& name)
{
std::string capitalized_name = name;
std::transform( capitalized_name.begin(), capitalized_name.end(), capitalized_name.begin(), toupper);
return capitalized_name;
}
bool directoryExists( const char * dir)
{
bool res = false;
CFileStatus stat;
if( dir // not-empty string
&& CFile::GetStatus( dir, stat)) // status fetched succesfully
{
if( (stat.m_attribute & CFile::directory) == CFile::directory // it is a directory
&& (stat.m_attribute & CFile::readOnly) == 0) // not read only
{
res = true;
}
}
return res;
}
bool directoryCreate( const char * dir)
{
return CreateDirectory( dir, NULL) == TRUE;
}
--- NEW FILE: ComponentConfig.h ---
// Component configuration file automatically generated as ComponentConfig.h
// by ConfigureComponent on Wed Mar 12 13:17:02 2008
#define RAWCOMPONENT
// COM UUID-s, names and progID
#define TYPELIB_UUID "8694B82B-BFC8-436E-A683-3F19CF379428"
#define TYPELIB_NAME "MGA Interpreter TypeLibrary (BonXtender8)"
#define COCLASS_UUID "DA089C0B-496D-4E1D-874D-359F262926A3"
#define COCLASS_NAME "MGA Interpreter CoClass (BonXtender8)"
#define COCLASS_PROGID "MGA.Interpreter.BonXtender8"
// This name will appear in the popup window for interpreter selection.
#define COMPONENT_NAME "BonXtender8"
// This text will appear in the toolbar icon tooltip and in the menu.
#define TOOLTIP_TEXT "BonXtender8 Interpreter"
// This #define determines the interpreter type:
#define GME_INTERPRETER
// The name of the paradigm(s). The GME will use this component
// for this paradigm. Separate the names of paradigms by commas.
#define PARADIGMS "MetaGME"
// This is the location of the GME interfaces file (Mga.idl, Meta.idl, etc)
#define GME_BASE ../../../GME
#define BON_ICON_SUPPORT
// not defined: #define BON_CUSTOM_TRANSACTIONS
// not defined: #define REGISTER_SYSTEMWIDE
// Just to please the whims of those Microsoft jerks:
#define COCLASS_UUID_EXPLODED1 0xDA089C0B
#define COCLASS_UUID_EXPLODED2 0x496D
#define COCLASS_UUID_EXPLODED3 0x4E1D
#define COCLASS_UUID_EXPLODED4 0x87
#define COCLASS_UUID_EXPLODED5 0x4D
#define COCLASS_UUID_EXPLODED6 0x35
#define COCLASS_UUID_EXPLODED7 0x9F
#define COCLASS_UUID_EXPLODED8 0x26
#define COCLASS_UUID_EXPLODED9 0x29
#define COCLASS_UUID_EXPLODED10 0x26
#define COCLASS_UUID_EXPLODED11 0xA3
--- NEW FILE: BonXtender8.vcproj ---
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="BonXtender8"
ProjectGUID="{DF66F798-BCC9-44D0-9FFB-1148C353DDD7}"
SccProjectName=""
SccLocalPath=""
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="Gui,Rep,./,../../../sdk/BON/"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/BonXtender8.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/BonXtender8.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/BonXtender8.pdb"
SubSystem="2"
ImportLibrary=".\Debug/BonXtender8.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/BonXtender8.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="Gui,Rep,./,../../../sdk/BON/"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/BonXtender8.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/BonXtender8.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
ProgramDatabaseFile=".\Release/BonXtender8.pdb"
SubSystem="2"
ImportLibrary=".\Release/BonXtender8.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/BonXtender8.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\SDK\bon\ComHelp.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath="Component.def">
</File>
<File
RelativePath="Component.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentDll.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentLib.idl">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="$(ProjectDir)"
TypeLibraryName="$(OutDir)/ComponentLib.tlb"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="$(ProjectDir)"
TypeLibraryName="$(OutDir)/ComponentLib.tlb"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentObj.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath=".\Console.cpp">
</File>
<File
RelativePath=".\Engine.cpp">
</File>
<File
RelativePath=".\logger.cpp">
</File>
<File
RelativePath=".\LogStream.cpp">
</File>
<File
RelativePath=".\myutil.cpp">
</File>
<File
RelativePath="RawComponent.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath=".\Regexp.cpp">
</File>
<File
RelativePath=".\relation.cpp">
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\..\..\SDK\bon\ComHelp.h">
</File>
<File
RelativePath="ComponentConfig.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentDll.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentObj.h">
</File>
<File
RelativePath=".\Console.h">
</File>
<File
RelativePath=".\entity.h">
</File>
<File
RelativePath=".\Globals.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\GMECOM.h">
</File>
<File
RelativePath=".\logger.h">
</File>
<File
RelativePath=".\LogStream.h">
</File>
<File
RelativePath=".\myutil.h">
</File>
<File
RelativePath="RawComponent.h">
</File>
<File
RelativePath=".\Regexp.h">
</File>
<File
RelativePath=".\relation.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<Filter
Name="Gui"
Filter="">
<File
RelativePath=".\Gui\InPlaceEdit.cpp">
</File>
<File
RelativePath=".\Gui\InPlaceEdit.h">
</File>
<File
RelativePath=".\Gui\InPlaceList.cpp">
</File>
<File
RelativePath=".\Gui\InPlaceList.h">
</File>
<File
RelativePath=".\Gui\OptionsDlg.cpp">
</File>
<File
RelativePath=".\Gui\OptionsDlg.h">
</File>
<File
RelativePath=".\Gui\SelConf.cpp">
</File>
<File
RelativePath=".\Gui\SelConf.h">
</File>
<File
RelativePath=".\Gui\Table.cpp">
</File>
<File
RelativePath=".\Gui\Table.h">
</File>
</Filter>
<Filter
Name="Rep"
Filter="">
<File
RelativePath=".\Rep\Any.cpp">
</File>
<File
RelativePath=".\Rep\Any.h">
</File>
<File
RelativePath=".\Rep\AtomRep.cpp">
</File>
<File
RelativePath=".\Rep\AtomRep.h">
</File>
<File
RelativePath=".\Rep\AttributeRep.cpp">
</File>
<File
RelativePath=".\Rep\AttributeRep.h">
</File>
<File
RelativePath=".\Rep\CodeGen.cpp">
</File>
<File
RelativePath=".\Rep\CodeGen.h">
</File>
<File
RelativePath=".\Rep\CodeGenReg.cpp">
</File>
<File
RelativePath=".\Rep\CodeGenTemplate.cpp">
</File>
<File
RelativePath=".\Rep\ConnectionRep.cpp">
</File>
<File
RelativePath=".\Rep\ConnectionRep.h">
</File>
<File
RelativePath=".\Rep\ConnJoint.cpp">
</File>
<File
RelativePath=".\Rep\ConnJoint.h">
</File>
<File
RelativePath=".\Rep\Dumper.cpp">
</File>
<File
RelativePath=".\Rep\Dumper.h">
</File>
<File
RelativePath=".\Rep\FCO.cpp">
</File>
<File
RelativePath=".\Rep\FCO.h">
</File>
<File
RelativePath=".\Rep\FcoRep.cpp">
</File>
<File
RelativePath=".\Rep\FcoRep.h">
</File>
<File
RelativePath=".\Rep\FolderRep.cpp">
</File>
<File
RelativePath=".\Rep\FolderRep.h">
</File>
<File
RelativePath=".\Rep\MakeVisitor.cpp">
</File>
<File
RelativePath=".\Rep\MakeVisitor.h">
</File>
<File
RelativePath=".\Rep\Method.cpp">
</File>
<File
RelativePath=".\Rep\Method.h">
</File>
<File
RelativePath=".\Rep\ModelRep.cpp">
</File>
<File
RelativePath=".\Rep\ModelRep.h">
</File>
<File
RelativePath=".\Rep\PointerItem.cpp">
</File>
<File
RelativePath=".\Rep\PointerItem.h">
</File>
<File
RelativePath=".\Rep\ReferenceRep.cpp">
</File>
<File
RelativePath=".\Rep\ReferenceRep.h">
</File>
<File
RelativePath=".\Rep\RoleRep.cpp">
</File>
<File
RelativePath=".\Rep\RoleRep.h">
</File>
<File
RelativePath=".\Rep\RootFolder.cpp">
</File>
<File
RelativePath=".\Rep\RootFolder.h">
</File>
<File
RelativePath=".\Rep\SetRep.cpp">
</File>
<File
RelativePath=".\Rep\SetRep.h">
</File>
<File
RelativePath=".\Rep\Sheet.cpp">
</File>
<File
RelativePath=".\Rep\Sheet.h">
</File>
</Filter>
<File
RelativePath="ConfigureComponent.exe">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
--- NEW FILE: RawComponent.cpp ---
///////////////////////////////////////////////////////////////////////////
// RawComponent.cpp, the main RAW COM component implementation file
// This is the file (along with its header RawComponent.h)
// that the component implementor is expected to modify in the first place
//
///////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ComHelp.h"
#include "GMECOM.h"
#include <ComponentConfig.h>
#include "RawComponent.h"
#include "logger.h"
#include <string>
#include "Dumper.h"
#include "globals.h"
Globals global_vars;
class Deallocator
{
public:
Deallocator( RawComponent* pComp)
: m_pComp( pComp)
{
}
~Deallocator()
{
global_vars.err.m_proj = CComPtr<IMgaProject>( 0);
if( m_pComp) m_pComp->finiMembers();
else ASSERT(0);
}
protected:
RawComponent *m_pComp;
};
// this method is called after all the generic initialization is done
// this should be empty, unless application-specific initialization is needed
STDMETHODIMP RawComponent::Initialize(struct IMgaProject *) {
return S_OK;
}
void RawComponent::finalize()
{
finiMembers();
}
void RawComponent::scanSubModels( IMgaModel* model)
{
CComPtr<IMgaFCOs> children;
COMTHROW( model->get_ChildFCOs( &children));
long c = 0;
if( children) COMTHROW( children->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaFCO> ch;
COMTHROW( children->get_Item( i, &ch));
CComQIPtr<IMgaModel> mch( ch); // model child?
if( mch) scanSubModels( mch);
}
}
void RawComponent::scanModels( IMgaModel* model, IMgaFolder* parent)
{
scanSubModels( model);
entityBuilder( model, parent);
m_setOfParShs.insert( model);
}
void RawComponent::scanSubFolders( IMgaFolders* subfolders, CComPtr<IMgaFolders>& result)
{
if( !subfolders) return;
if( !result) return;
// result->Append( subfolders);
long c = 0;
COMTHROW( subfolders->get_Count( &c));
CComPtr<IMgaFolder> ch;
for( long i = 1; i <= c; ++i)
{
COMTHROW( subfolders->get_Item( i, &ch));
result->Append( ch);
CComPtr<IMgaFolders> childfolders;
COMTHROW( ch->get_ChildFolders( &childfolders));
scanSubFolders( childfolders, result);
}
}
void RawComponent::scanProject( IMgaProject* project)
{
try
{
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
//Sheet::m_BON_Project_Root_Folder2 = rf;
CComPtr<IMgaFolders> folders;
folders.CoCreateInstance( L"Mga.MgaFolders");
COMTHROW( folders->Append( rf)); // including root folder
CComPtr<IMgaFolders> subfolders;
COMTHROW( rf->get_ChildFolders( &subfolders)); // scan folders (libraries are included also)
// folders->AppendAll( subfolders);
long c = 0;
if( subfolders) COMTHROW( subfolders->get_Count( &c));
CComPtr<IMgaFolder> ch;
for( long i = 1; i <= c; ++i)
{
COMTHROW( subfolders->get_Item( i, &ch));
COMTHROW( folders->Append( ch));
}
long d = 0;
if( folders) COMTHROW( folders->get_Count( &d));
for( long i = 1; i <= d; ++i)
{
CComPtr<IMgaFolder> ch;
COMTHROW( folders->get_Item( i, &ch));
CComPtr<IMgaFCOs> chfcos;
if( ch) COMTHROW( ch->get_ChildFCOs( &chfcos));
long e = 0;
if( chfcos) COMTHROW( chfcos->get_Count( &e));
for( long j = 1; j <= e; ++j)
{
CComPtr<IMgaFCO> inner_ch;
COMTHROW( chfcos->get_Item( j, &inner_ch));
CComQIPtr<IMgaModel> chmod( inner_ch);
if( chmod) scanModels( chmod, ch); // scan all root models
}
}
}
catch(...)
{
global_vars.err << MSG_ERROR << "Exception thrown during project scanning.\n";
}
}
void RawComponent::initMembers( IMgaProject* project)
{
CComBSTR nm;
COMTHROW( project->get_Name( &nm));
m_projectName = Util::Copy( nm);
m_dir = "";
if ( global_vars.silent_mode)
{
CComBSTR connString;
COMTHROW( project->get_ProjectConnStr(&connString));
std::string path = Util::Copy( connString);
int e = path.rfind('\\');
if( e != std::string::npos && path.substr(0, 4) == "MGA=") m_dir = path.substr(4, e-3); // cut leading "MGA=" , preserve tailing '\\'
}
m_entities.clear();
//m_toBeDeletedEntities.clear();
m_relations.clear();
m_equivRelations.clear();
m_realObj.clear();
m_sheet = 0;
}
void RawComponent::finiMembers()
{
//Sheet::m_BON_Project_Root_Folder = NULL; // crucial!!!
m_entities.clear();
m_relations.clear();
m_equivRelations.clear();
//m_toBeDeletedEntities.clear();
m_equivBag.clear();
m_realObj.clear();
m_setOfParShs.erase( m_setOfParShs.begin(), m_setOfParShs.end());
m_setOfParShs.clear();
if ( m_sheet != 0)
{
TO( "Internal error: Merged Paradigm Sheet object still exists.");
delete m_sheet;
m_sheet = 0;
}
}
void RawComponent::createSheet()
{
//
//TODO : create your own Sheet instance (should be a derived class from the Sheet)
// store the pointer in the m_sheet member
m_sheet = Dumper::getInstance();
}
bool RawComponent::populateSheet( IMgaProject* project )
{
m_sheet->setProject( project );
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
m_sheet->m_BON_Project_Root_Folder2 = rf;
m_sheet->m_setOfParadigmSheets2 = m_setOfParShs;
m_setOfParShs.clear();
bool error = false;
Entity_Iterator it_1( m_entities.begin());
Any * new_elem = 0;
for( ; it_1 != m_entities.end(); ++it_1 )
{
if ( it_1->isDeleted()) continue;
IMgaFCO* fco( it_1->getPointer());
IMgaFCO* resp( it_1->getRespPointer());
IMgaFolder* parent_folder( it_1->getParentFolder());
IMgaFolder* orig_parent_folder( parent_folder);
if( Util::islibobj( parent_folder)) // element's parent is in a library?
{
// This means we face a nested library, whose rootfolder is also
// write protected, meaning that it's registry can't be written.
// We will use the main rootfolder instead
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
parent_folder = rf;
}
if ( !fco) global_vars.err << MSG_ERROR << "Populate sheet: tries to create Rep with empty FCO.\n";
else
{
new_elem = 0;
std::string stereotype = Util::kind( fco);
if ( stereotype == "FCO" )
new_elem = m_sheet->createFcoRep( fco, resp);
else if ( stereotype == "Atom" )
new_elem = m_sheet->createAtomRep( fco, resp);
else if ( stereotype == "Model" )
new_elem = m_sheet->createModelRep( fco, resp);
else if ( stereotype == "Connection" )
new_elem = m_sheet->createConnectionRep( fco, resp);
else if ( stereotype == "Set" )
new_elem = m_sheet->createSetRep( fco, resp);
else if ( stereotype == "Reference" )
new_elem = m_sheet->createReferenceRep( fco, resp);
else if ( stereotype == "Folder" )
new_elem = m_sheet->createFolderRep( fco, resp);//(resp != BON::FCO())?resp:fco);
else if ( stereotype == "Aspect" )
;//new_elem = m_sheet->createAspectRep( fco, resp);//(resp != BON::FCO())?resp:fco);
else if ( stereotype == "Constraint" )
;//new_elem = m_sheet->createConstraintRep( fco);
else if ( stereotype == "ConstraintFunc" )
;//new_elem = m_sheet->createConstraintFuncRep( fco);
else if ( stereotype == "BooleanAttribute" )
new_elem = m_sheet->createBoolAttributeRep( fco);
else if ( stereotype == "EnumAttribute" )
new_elem = m_sheet->createEnumAttributeRep( fco);
else if ( stereotype == "FieldAttribute" )
new_elem = m_sheet->createFieldAttributeRep( fco);
else
{
global_vars.err << MSG_ERROR << "Not inserted into the sheet: " << fco << " of kind: " << Util::kind( fco) << "\n";
error = true;
}
if (new_elem)
{
new_elem->setParentFolder( parent_folder, orig_parent_folder);
if ( m_equivBag.find( fco) != m_equivBag.end())
{
new_elem->setEquivPeers( m_equivBag[ fco]);
}
}
}
} // for m_entities
if (error)
{
global_vars.err << MSG_ERROR << "Internal error during creation of entities. Exiting\n";
return false;
}
Relation_Iterator rel_it = m_relations.begin();
for( ; rel_it != m_relations.end(); ++rel_it)
{
Relation::OPER_TYPE oper = rel_it->getOperation();
if ( oper == Relation::INHERITANCE_OP ||
oper == Relation::INT_INHERITANCE_OP ||
oper == Relation::IMP_INHERITANCE_OP)
inheritancesManager( *rel_it);
else if ( oper == Relation::ASSOCIATION_OP)
associationClassManager( *rel_it);
else if ( oper == Relation::REFER_TO_OP)
refersToManager( *rel_it);
else if ( oper == Relation::SET_MEMBER_OP)
setMemberManager( *rel_it);
else if ( oper == Relation::CONTAINMENT_OP)
containmentManager( *rel_it);
else if ( oper == Relation::FOLDER_CONTAINMENT_OP)
folderContainmentManager( *rel_it);
//else if ( oper == Relation::HAS_ASPECT_OP)
// hasAspectManager( *rel_it);
//else if ( oper == Relation::ASPECT_MEMBER_OP)
// aspectMemberManager( *rel_it);
//else if ( oper == Relation::HAS_CONSTRAINT_OP)
// hasConstraintManager( *rel_it);
else if ( oper == Relation::HAS_ATTRIBUTE_OP)
hasAttributeManager( *rel_it);
}
if (error)
{
global_vars.err << MSG_ERROR << "Internal error during the relation establishment. Exiting\n";
return false;
}
return true;
}
bool RawComponent::executeSheet()
{
bool success = false;
try
{
//CRUCIAL step: the role names may be short or long form
success = m_sheet->finalize();
if (success)
success = m_sheet->build();
else
global_vars.err << MSG_ERROR << "Internal error: Sheet::finalize() returned with error\n";
}
catch( std::string exc_str)
{
global_vars.err << MSG_ERROR << "Something went wrong in executeSheet. Msg: " << exc_str << "\n";
success = false;
}
catch(...)
{
global_vars.err << MSG_ERROR << "Something went wrong in executeSheet\n";
success = false;
}
return success;
}
void RawComponent::deleteSheet()
{
if ( m_sheet) delete m_sheet;
m_sheet = 0;
}
// ====================================================
// This is the main component method for Interpereters and Plugins.
// May also be used in case of invokeable Add-Ons
// this is the obsolete component interface
// this present implementation either tries to call InvokeEx, or returns an error;
STDMETHODIMP RawComponent::Invoke(IMgaProject* gme, IMgaFCOs *models, long param) {
#ifdef SUPPORT_OLD_INVOKE
CComPtr<IMgaFCO> focus;
CComVariant parval = param;
return InvokeEx(gme, focus, selected, parvar);
#else
if(interactive) {
AfxMessageBox("This component does not support the obsolete invoke mechanism");
}
return E_MGA_NOT_SUPPORTED;
#endif
}
// This is the main component method for interpereters and plugins.
// May als be used in case of invokeable addons
STDMETHODIMP RawComponent::InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param)
{
COMTRY {
if(interactive) {
CComBSTR projname;
CComBSTR focusname = "<nothing>";
CComPtr<IMgaTerritory> terr;
COMTHROW(project->CreateTerritory(NULL, &terr));
COMTHROW(project->BeginTransaction(terr));
try
{
invokeEx( project, currentobj, selectedobjs, param);
finalize();
COMTHROW(project->CommitTransaction());
}
catch(...) {
finalize();
project->AbortTransaction();
throw;
}
}
} COMCATCH(;);
}
void RawComponent::invokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param)
{
// ======================
// Insert application specific code here
global_vars.silent_mode = (param == GME_SILENT_MODE);
// when deallocated will clear the member variables of Component upon leaving the scope (and some of global_vars)
Deallocator g( this);
initMembers( project);
global_vars.err.m_proj = project;
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
global_vars.m_namespace_name = Util::getReg( rf, "Namespace");
CComPtr<IMgaRegNode> opt_rn;
COMTHROW( rf->get_RegistryNode( Util::Copy( std::string( Dumper::m_strBonExtenderOptions)), &opt_rn));
if ( Dumper::selectOutputFiles( m_projectName, opt_rn) > 1)
{
if( !global_vars.silent_mode) m_console.sendMsg("[BonExtender] Output file name selection cancelled by the user or other file operation failed.", MSG_NORMAL);
return;
}
CWaitCursor wait;
CTime theTime = CTime::GetCurrentTime();
CString s = theTime.Format("%#c");
s = "BonExtender LOG STARTED " + s;
// don't create file output anymore
//global_vars.err.open( global_vars.err_file_name.c_str(), std::ios_base::out);
global_vars.err << MSG_NORMAL << std::string( s.GetLength(), '=') << "\n";
global_vars.err << (LPCTSTR) s << "\n";
global_vars.err << MSG_NORMAL << std::string( s.GetLength(), '=') << "\n";
global_vars.dmp_s.open( global_vars.source_file_name.c_str(), std::ios_base::out);
global_vars.dmp_h.open( global_vars.header_file_name.c_str(), std::ios_base::out);
//-
try {
scanProject( project);
CHECK();
m_entities.sort();
m_equivRelations.sort(); // tries to ensure the same order of handling the equivalences
selectFromSameAspectsFolders(); // selects names for the equivalent objects (designates the nameresp pointers)
proxyFinder(); // replaces proxies with the real objects
equivalenceFinder(); // merges the equivalent objects (the relations they are part of)
removeProxiesAndEquiv();
while ( !checkForProxies()) { }
bool do_at_all = true;
if ( do_at_all)
{
if ( Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: merged paradigm sheet already exists\n";
createSheet();
bool success = false;
try
{
success = populateSheet( project );
if ( success)
success = executeSheet();
else
global_vars.err << MSG_ERROR << "Internal error: PopulateSheet returned with error\n";
}
catch( std::string exc_str)
{
global_vars.err << MSG_ERROR << "Internal error: Exception caught during populate/execute. Msg: " << exc_str << "\n";
}
catch(...)
{
global_vars.err << MSG_ERROR << "Internal error: Exception caught during populate/execute.\n";
}
if ( !Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: Merged Sheet object doesn't exist\n";
deleteSheet();
}
else
global_vars.err << MSG_ERROR << "Exited before populating the Merged Paradigm Sheet. Proxy or other problem may exist.\n";
} catch (...)
{
global_vars.err << MSG_ERROR << "Internal error: Exception thrown by Component.\n";
deleteSheet();
}
if ( Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: Merged Paradigm Sheet object still exists\n";
global_vars.dmp_h.close();
global_vars.dmp_s.close();
global_vars.err << MSG_NORMAL << "\nEND OF LOG\n";
// don't create file output anymore
//global_vars.err.flushit();
//global_vars.err.close();
global_vars.err.m_proj = CComPtr<IMgaProject>( 0);
long r = 0; // remove all items from safe
if( m_safe) COMTHROW( m_safe->get_Count( &r));
while( r > 0) COMTHROW( m_safe->Remove( r--));
}
// GME currently does not use this function
// you only need to implement it if other invokation mechanisms are used
STDMETHODIMP RawComponent::ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param) {
if(interactive) {
AfxMessageBox("Tho ObjectsInvoke method is not implemented");
}
return E_MGA_NOT_SUPPORTED;
}
// implement application specific parameter-mechanism in these functions:
STDMETHODIMP RawComponent::get_ComponentParameter(BSTR name, VARIANT *pVal) {
return S_OK;
}
STDMETHODIMP RawComponent::put_ComponentParameter(BSTR name, VARIANT newVal) {
return S_OK;
}
#ifdef GME_ADDON
// these two functions are the main
STDMETHODIMP RawComponent::GlobalEvent(globalevent_enum event) {
if(event == GLOBALEVENT_UNDO) {
AfxMessageBox("UNDO!!");
}
return S_OK;
}
STDMETHODIMP RawComponent::ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v) {
if(eventmask & OBJEVENT_CREATED) {
CComBSTR objID;
COMTHROW(obj->get_ID(&objID));
AfxMessageBox( "Object created! ObjID: " + CString(objID));
}
return S_OK;
}
#endif
--- NEW FILE: RawComponent.h ---
#ifndef RAWCOMPONENT_H
#define RAWCOMPONENT_H
// Declaration of the main RAW COM component interface class
#ifdef BUILDER_OBJECT_NETWORK
#error This file should only be included in the RAW COM configurations
#endif
#include <string>
#include <list>
#include <map>
#include <algorithm>
#include "entity.h"
#include "relation.h"
#include "Console.h"
#include "FCO.h"
#include "Sheet.h"
class RawComponent {
////////////////////
// Insert your application specific member and method definitions here
public:
RawComponent() { ; }
private:
void finalize();
void invokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
Console m_console;
private:
typedef std::list< Entity > Entities;
typedef Entities::iterator Entity_Iterator;
typedef Entities::const_iterator Entity_Const_Iterator;
typedef std::list< Relation > Relations;
typedef Relations::iterator Relation_Iterator;
typedef Relations::const_iterator Relation_Const_Iterator;
typedef CComPtr<IMgaFCO> ObjPointer;
//typedef IMgaFCO* ObjPointer;
typedef std::map< ObjPointer, ObjPointer> RealMap;
typedef std::map< ObjPointer, ObjPointer>::iterator RealMap_Iterator;
typedef std::map< ObjPointer, std::set < ObjPointer > > EquivBag;
typedef std::map< ObjPointer, std::set < ObjPointer > >::iterator EquivBag_Iterator;
CComPtr<IMgaObjects> m_safe;
private: // members
std::string m_projectName;
std::string m_dir; // stores the directory names the interpreter has been invoked with
Entities m_entities;
//Entities m_toBeDeletedEntities;
Relations m_relations;
Relations m_equivRelations;
RealMap m_realObj;
EquivBag m_equivBag;
std::set<CComPtr<IMgaModel> > m_setOfParShs;
private: // methods
void initMembers( IMgaProject* project);
public:
void finiMembers();
private:
void scanProject( IMgaProject* project);
void scanModels( IMgaModel* model, IMgaFolder* parent);
void scanSubModels( IMgaModel* model);
void scanSubFolders( IMgaFolders* folders, CComPtr<IMgaFolders>& result);
void entityBuilder( IMgaModel* model, IMgaFolder* parent);
void selectFromSameAspectsFolders();
void storeEntity( const Entity& p);
void storeRelation( Relation& p);
void storeEquivRelation( Relation& p);
void proxyFinder();
void equivalenceFinder();
void removeProxiesAndEquiv();
bool nameSelector();
int isProxy( const ObjPointer& ptr);
void operandSearchAndReplace( const std::vector<ObjPointer>& proxy_obj, const ObjPointer& real_obj);
void operandSearchAndReplace( const ObjPointer& proxy_obj, const ObjPointer& real_obj);
void insertIntoEquivBag( const ObjPointer& obj1, const ObjPointer& obj2);
void markEquivEntities();
Entity entitySearch( const ObjPointer& p_ptr);
bool checkForProxies();
void CHECK();
private:
Sheet * m_sheet;
void createSheet(); // TODO: modify this method to create your specific object
bool populateSheet( IMgaProject* project );
bool executeSheet();
void deleteSheet();
void inheritancesManager( Relation & );
void refersToManager( Relation & );
void associationClassManager( Relation & );
void setMemberManager( Relation & );
void containmentManager( Relation & );
void folderContainmentManager( Relation & );
void hasAspectManager( Relation & );
void aspectMemberManager( Relation & );
void hasConstraintManager( Relation & );
void hasAttributeManager( Relation & );
// Try not to modify the code below this line
////////////////////
public:
#ifdef GME_ADDON
CComPtr<IMgaProject> project; // this is set before Initialize() is called
CComPtr<IMgaAddOn> addon; // this is set before Initialize() is called
#endif
bool interactive;
STDMETHODIMP Initialize(struct IMgaProject *);
STDMETHODIMP Invoke(IMgaProject* gme, IMgaFCOs *models, long param);
STDMETHODIMP InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
STDMETHODIMP ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param);
STDMETHODIMP get_ComponentParameter(BSTR name, VARIANT *pVal);
STDMETHODIMP put_ComponentParameter(BSTR name, VARIANT newVal);
#ifdef GME_ADDON
STDMETHODIMP GlobalEvent(globalevent_enum event);
STDMETHODIMP ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v);
#endif
};
#endif //RAWCOMPONENT_H
--- NEW FILE: Component.rc ---
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""ComponentLib.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "FileDescription", "Interpreter Module"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Interpreter"
VALUE "LegalCopyright", "Copyright 2000"
VALUE "OriginalFilename", "Interpreter.DLL"
VALUE "ProductName", "Interpreter Module"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_COMPICON ICON "compicon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 341
TOPMARGIN, 7
BOTTOMMARGIN, 275
END
IDD_DIALOG2, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 298
TOPMARGIN, 7
BOTTOMMARGIN, 299
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOGEX 0, 0, 348, 282
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select classes to extend"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,92,261,50,14
PUSHBUTTON "Cancel",IDCANCEL,191,261,50,14
COMBOBOX IDC_COMBO1,85,5,183,70,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP
LTEXT "Select configuration:",IDC_STATIC,14,6,68,10
PUSHBUTTON "None",IDC_DESELECTALLBTN,281,6,26,11
PUSHBUTTON "All",IDC_SELECTALLBTN,314,6,26,11
END
IDD_DIALOG2 DIALOGEX 0, 0, 305, 306
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
GROUPBOX "Output header and source files",IDC_STATIC,7,6,291,51
EDITTEXT IDC_EDIT1,18,18,261,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON1,283,18,10,11
EDITTEXT IDC_EDIT2,18,35,261,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON2,283,36,10,11
GROUPBOX "",IDC_STATIC,7,59,291,39
CONTROL "&Parse header file generated before",IDC_CHECK5,"Button",
BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,57,123,13
EDITTEXT IDC_EDIT5,18,75,261,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON5,283,76,10,11
GROUPBOX "",IDC_STATIC,7,102,291,68
CONTROL "&Visitor",IDC_CHECK34,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,103,35,10
EDITTEXT IDC_EDIT3,18,116,261,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON3,283,116,10,11
EDITTEXT IDC_EDIT4,18,132,261,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON4,283,133,10,11
LTEXT "Visitor method's signature:",IDC_STATIC,17,148,82,8
CONTROL "visitNamespaceElement(...)",IDC_RADIOVISITSIGN1,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,104,149,101,
10
CONTROL "visitElement(...)",IDC_RADIOVISITSIGN2,"Button",
BS_AUTORADIOBUTTON,104,158,63,10
GROUPBOX "Generate methods",IDC_STATIC,7,173,188,53
CONTROL "&initialize()",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,183,44,10
CONTROL "&finalize()",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,193,41,10
CONTROL "&accept() with traversal code",IDC_CHECK4,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,62,183,129,10
CONTROL "&accept(CustomVisitor *v)",IDC_CHECK6,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,62,193,93,10
CONTROL "returns void",IDC_RADIOSPACCRETURNSVOID,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,73,205,53,10
CONTROL "returns bool",IDC_RADIOSPACCRETURNSBOOL,"Button",
BS_AUTORADIOBUTTON,73,215,53,10
GROUPBOX "Getter style",IDC_STATIC,202,173,96,53
CONTROL "VC ver. 6",IDC_CHECKVERS60,"Button",BS_AUTOCHECKBOX |
BS_MULTILINE | WS_TABSTOP,248,172,46,11
CONTROL "&Simple",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,208,187,39,8
CONTROL "&Template method",IDC_RADIO2,"Button",
BS_AUTORADIOBUTTON,208,199,72,8
CONTROL "&Both",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,208,211,
39,8
EDITTEXT IDC_EDIT6,162,238,126,14,ES_AUTOHSCROLL
CONTROL "S&ame file",IDC_RADIOSAMEFILE,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,162,255,49,8
CONTROL "S&eparate files",IDC_RADIOSEPAFILE,"Button",
BS_AUTORADIOBUTTON,162,266,79,8
DEFPUSHBUTTON "OK",IDOK,74,285,50,14
PUSHBUTTON "Cancel",IDCANCEL,185,285,50,14
GROUPBOX "Misc",IDC_STATIC,7,226,291,53
LTEXT "Classes will be generated into namespace:",IDC_STATIC,
17,240,134,8
LTEXT "Output custom classes to:",IDC_STATIC,17,254,82,8
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "Component"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "ComponentLib.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
--- NEW FILE: LogStream.cpp ---
#include "stdafx.h"
#include "LogStream.h"
#include "MyUtil.h"
#include "Console.h"
#include "globals.h"
extern Globals global_vars;
LogStream::LogStream()
: m_proj( 0)
, m_msgtype( MSG_NORMAL)
, m_buff()
{ }
LogStream::~LogStream()
{
m_proj = 0;
m_buff = "";
}
void LogStream::flushit()
{
*this << "\n"; // flush
}
//
// friend put-to operators
LogStream& operator<<( LogStream& stream, msgtype_enum msgtype)
{
if( !stream.m_buff.empty()) stream << "\n"; // like a flush
stream.m_msgtype = msgtype;
/*switch( stream.m_msgtype) {
case MSG_ERROR: stream.write( "Error: ", 7); break;
case MSG_WARNING: stream.write( "Warning: ", 9); break;
case MSG_INFO: stream.write( "Info: ", 5); break;
case MSG_NORMAL: ;
}*/
return stream;
}
LogStream& operator<<( LogStream& stream, IMgaFCO* fco)
{
std::string tok = "<b>Null_object</b>";
if( fco)
{
try {
std::string id, nm;
CComBSTR b_id, b_nm;
COMTHROW( fco->get_ID( &b_id));
COMTHROW( fco->get_Name( &b_nm));
id = Util::Copy( b_id);
nm = Util::Copy( b_nm);
tok = "<A HREF=\"mga:" + id +"\">" + nm + "</A>";
} catch( ...) {
}
}
return stream << tok;
}
LogStream& operator<<( LogStream& stream, const char * r)
{
return stream << std::string( r);
}
LogStream& operator<<( LogStream& stream, const std::string& r)
{
//stream.write( r.c_str(), r.length()); // don't create file output anymore
stream.m_buff += r;
if( r.find('\n') != std::string::npos)
{
if( !global_vars.silent_mode) {
try { Console::ssendMsg( stream.m_buff, stream.m_msgtype); }
catch( ... ) { } // will throw if invoked without the Gui up&running
}
stream.m_buff = "";
}
return stream;
}
LogStream& operator<<( LogStream& stream, const int i)
{
char t[32];
sprintf( t, "%i", i);
return stream << std::string( t);
}
--- NEW FILE: Console.cpp ---
#include "stdafx.h"
#include ".\console.h"
#include "myUtil.h"
Console::Console(void)
: m_gme( 0)
{
}
Console::~Console(void)
{
m_gme = 0;
}
Console::GMEAppPtr Console::getGME( IMgaProject* project)
{
if (!m_gme) {
CComBSTR bstrName("GME.Application");
CComQIPtr<IMgaClient> pClient;
HRESULT hr = project->GetClientByName( bstrName, &pClient);
if (SUCCEEDED( hr) && pClient) {
CComQIPtr<IDispatch> pDispatch;
COMTHROW(pClient->get_OLEServer(&pDispatch));
if (pDispatch) {
COMTHROW(pDispatch.QueryInterface( &m_gme));
}
}
}
return m_gme;
}
void Console::init( IMgaProject* project)
{
m_gme = getGME( project);
}
void Console::sendMsg( const std::string& p_msg, msgtype_enum p_type)
{
if( m_gme)
m_gme->ConsoleMessage( Util::Copy( p_msg), p_type);
else
ssendMsg( p_msg, p_type);
}
//static
Console::ssendMsg( const std::string& p_msg, msgtype_enum p_type)
{
//GMEAppPtr p_gme = getGME( 0);
GMEAppPtr p;
p.CoCreateInstance( L"GME.Application");
p->ConsoleMessage( Util::Copy( p_msg), p_type);
}
--- NEW FILE: logger.h ---
#ifndef LOGGER_H
#define LOGGER_H
#define LONG_NAMES 0
#include "string"
#include "algorithm"
#include "globals.h"
extern Globals global_vars;
inline void DMP_H(const char * msg)
{
global_vars.dmp_h << msg;
}
inline void DMP_S(const char * msg)
{
global_vars.dmp_s << msg;
}
inline void TO(const char * msg)
{
//AfxMessageBox(msg);
global_vars.err << MSG_ERROR << msg << "\n" << MSG_NORMAL;
}
inline void TO(const CString msg) { TO( (LPCTSTR) msg); }
inline void TO(const std::string msg) { TO( msg.c_str()); }
inline void DMP(const std::string& msg) { DMP( msg.c_str() ); }
inline void DMP_H(const std::string& msg) { DMP_H( msg.c_str() ); }
inline void DMP_S(const std::string& msg) { DMP_S( msg.c_str() ); }
bool existsFile( const char * src_name);
bool fileExists( const char * file_name);
int makeFileCopy( const char * src_name, const char * dst_name);
int makeFileMove( const char * src_name, const char * dst_name);
std::string shortFileName( const std::string& long_name);
std::string cutExtension( const std::string& filename);
std::string capitalizeString( const std::string& name);
bool directoryExists( const char * dir);
bool directoryCreate( const char * dir);
#endif // LOGGER_H
--- NEW FILE: myutil.h ---
#pragma once
#include <string>
#include "ComponentLib.h"
#include "GMECOM.h"
//interface IMgaFCO;
//interface IMgaFolder;
//interface IMgaProject;
namespace Util
{
CComBSTR Copy( const std::string& str );
std::string Copy( const CComBSTR& bstr );
std::string CopyV( const CComVariant& pvar);
std::string gvbp( IMgaRegNode* p_rn, const std::string& p_path);
void svbp( IMgaRegNode* p_rn, const std::string& p_path, const std::string& p_value);
std::string getReg( IMgaFolder* ptr, const std::string& p_path);
std::string getReg( IMgaFCO* ptr, const std::string& p_path);
void setReg( IMgaFCO* ptr, const std::string& p_path, const std::string& p_value);
bool islibobj( IMgaObject* p_ptr);
bool isproxy( IMgaFCO* p_ptr);
std::string name( IMgaObject* ptr);
std::string name( IMgaFCO* ptr);
std::string kind( IMgaObject* p_ptr);
std::string getStrAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
bool getBoolAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
long getLongAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
bool isAttrStatHere( IMgaFCO* p_fco, const std::string& p_attrName);
IMgaAttribute* getAttrib( IMgaFCO* p_fco, const std::string& p_attrName);
std::string composePath( IMgaObject * ptr, bool p_upUntilFolders = false); // SF/OutputSignal-24-Atom
}
--- NEW FILE: Globals.h ---
#ifndef GLOBALS_H
#define GLOBALS_H
#include "fstream"
#include "string"
#include "LogStream.h"
class Globals
{
public: // enum
typedef enum {
ALLTOGETHER = 0,
PERCLASS = 1,
PERNAMESPACE = 2,
X_THE_NO_OF_METHODS= 3 // upper boundary
} OUTPUTMETHOD_ENUM;
public:
Globals()
: err_file_name("\\ParadigmBonExt.log")
, header_backup_name("")
, header_file_name("\\ParadigmBonExtension.h")
, source_file_name("\\ParadigmBonExtension")
, m_visitorHeaderFileName("\\ParadigmVisitor.h")
, m_visitorSourceFileName("\\ParadigmVisitor")
, output_directory_name()
, m_namespace_name()
, m_outputMethod( ALLTOGETHER)
, silent_mode( false)
{ }
LogStream err;
std::ofstream dmp;
std::ofstream dmp_s;
std::ofstream dmp_h;
std::string err_file_name;
std::string header_backup_name;
std::string header_file_name;
std::string source_file_name;
std::string m_visitorHeaderFileName;
std::string m_visitorSourceFileName;
std::string output_directory_name;
std::string m_namespace_name;
OUTPUTMETHOD_ENUM m_outputMethod;
bool silent_mode;
};
#endif // GLOBALS_H
--- NEW FILE: relation.cpp ---
#include "stdafx.h"
#include "Relation.h"
const std::string Relation::containment_str("Containment");
const std::string Relation::folder_containment_str("FolderContainment");
const std::string Relation::set_membership_str("SetMembership");
const std::string Relation::refer_to_str("ReferTo");
const std::string Relation::has_aspect_str("HasAspect");
const std::string Relation::aspect_member_str("AspectMember");
const std::string Relation::has_constraint_str("HasConstraint");
const std::string Relation::has_attribute_str("HasAttribute");
const std::string Relation::connector_str("Connector");
const std::string Relation::connector_src("SourceToConnector");
const std::string Relation::connector_dst("ConnectorToDestination");
const std::string Relation::connector_descr("AssociationClass");
const std::string Relation::equivalence_str("Equivalence");
const std::string Relation::equivalence_right("EquivRight");
const std::string Relation::equivalence_left("EquivLeft");
const std::string Relation::inheritance_str("Inheritance");
const std::string Relation::inheritance_base("BaseInheritance");
const std::string Relation::inheritance_derived("DerivedInheritance");
const std::string Relation::int_inheritance_str("InterfaceInheritance");
const std::string Relation::int_inheritance_base("BaseIntInheritance");
const std::string Relation::int_inheritance_derived("DerivedIntInheritance");
const std::string Relation::imp_inheritance_str("ImplementationInheritance");
const std::string Relation::imp_inheritance_base("BaseImpInheritance");
const std::string Relation::imp_inheritance_derived("DerivedImpInheritance");
const std::string Relation::same_folder_str("SameFolder");
const std::string Relation::same_folder_right("SameFolderRight");
const std::string Relation::same_folder_left("SameFolderLeft");
const std::string Relation::same_aspect_str("SameAspect");
const std::string Relation::same_aspect_right("SameAspectRight");
const std::string Relation::same_aspect_left("SameAspectLeft");
--- NEW FILE: component.def ---
; Interpreter.def : Declares the module parameters.
LIBRARY "BonXtender8Component.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
--- NEW FILE: Resource.h ---
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Component.rc
//
#define IDS_PROJNAME 100
#define IDD_ASPECT_ORDER_PAGE 106
#define IDD_ASPECT_PAGE 107
#define IDC_TAB1 201
#define IDD_DIALOG1 203
#define IDD_DIALOG2 204
#define IDC_COMBO1 205
#define IDC_CHECK34 212
#define IDC_CHECK2 213
#define IDC_CHECK3 214
#define IDC_CHECK4 215
#define IDC_EDIT1 216
#define IDC_CHECK5 217
#define IDC_EDIT2 218
#define IDC_EDIT3 219
#define IDC_EDIT4 220
#define IDC_EDIT5 221
#define IDC_CHECK6 222
#define IDC_BUTTON1 223
#define IDC_BUTTON2 224
#define IDC_BUTTON5 225
#define IDC_BUTTON3 226
#define IDC_BUTTON4 227
#define IDC_RADIO1 228
#define IDC_RADIO2 229
#define IDC_RADIO3 230
#define IDC_RADIOSAMEFILE 231
#define IDC_RADIOSEPAFILE 232
#define IDC_CHECKVERS71 233
#define IDC_CHECKVERS60 233
#define IDC_DESELECTALLBTN 234
#define IDC_SELECTALLBTN 235
#define IDC_EDIT6 235
#define IDC_RADIOVISITSIGN1 237
#define IDC_RADIOVISITSIGN2 238
#define IDC_RADIOSPACCRETURNSVOID 239
#define IDC_RADIOSPVISRETURNSBOOL 240
#define IDC_RADIOSPACCRETURNSBOOL 240
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 205
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 240
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
--- NEW FILE: entity.h ---
#ifndef ENTITY_H
#define ENTITY_H
#include "MyUtil.h"
class Entity
{
public:
explicit Entity( IMgaFolder* parent, IMgaFCO* p, IMgaFCO* p2 = (IMgaFCO*)0)
: m_pointer( p), m_respPointer( p2), m_parentFolder( parent), m_deleted( false) { }
Entity( const Entity & operand )
: m_pointer(operand.m_pointer)
, m_respPointer( operand.m_respPointer)
, m_parentFolder( operand.m_parentFolder)
, m_deleted( operand.m_deleted)
{ }
const Entity& operator=(const Entity& operand)
{
if (&operand == this) return *this;
m_pointer = operand.m_pointer;
m_respPointer = operand.m_respPointer;
m_parentFolder = operand.m_parentFolder;
m_deleted = operand.m_deleted;
return *this;
}
~Entity() { }
bool operator==( const Entity& peer) { return (m_pointer == peer.m_pointer) && (m_respPointer == peer.m_respPointer) && (m_parentFolder == peer.m_parentFolder) && (m_deleted == peer.m_deleted); }
bool operator!=( const Entity& peer) { return !(*this==peer); }
bool operator<( const Entity& peer) const
{
IMgaFCO* f1 ( getPointer());
IMgaFCO* f2 ( peer.getPointer());
return ( Util::name( f1).compare( Util::name( f2)) < 0);
}
IMgaFCO* getPointer() const { return m_pointer; }
IMgaFCO* getRespPointer() const { return m_respPointer; }
IMgaFolder* getParentFolder() const { return m_parentFolder; }
void setPointer( IMgaFCO* p) { m_pointer = p; }
void setRespPointer( IMgaFCO* r_p) { m_respPointer = r_p; }
void setParentFolder( IMgaFolder* pf) { m_parentFolder = pf; }
bool isDeleted() const { return m_deleted; }
void deleted( const bool val) { m_deleted = val; }
//private:
IMgaFCO* m_pointer;
IMgaFCO* m_respPointer;
IMgaFolder* m_parentFolder;
bool m_deleted;
};
#endif // ENTITY_H
- Previous message: [GME-commit] GMESRC/Paradigms/MetaGME/BonExtension8/Gui - New directory
- Next message: [GME-commit] GMESRC/Paradigms/MetaGME/BonExtension8/Gui InPlaceEdit.cpp, NONE, 1.1 InPlaceEdit.h, NONE, 1.1 InPlaceList.cpp, NONE, 1.1 InPlaceList.h, NONE, 1.1 OptionsDlg.cpp, NONE, 1.1 OptionsDlg.h, NONE, 1.1 SelConf.cpp, NONE, 1.1 SelConf.h, NONE, 1.1 Table.cpp, NONE, 1.1 Table.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list