bc4head.sct

来自「c#设计模式WithCla」· SCT 代码 · 共 131 行

SCT
131
字号
NO_OUTPUT_BEGIN
For Borland C++ 4.X.  Enter include file names in the include box in With Class, e.g. cstring.h for string
class.  For 1 : Many relationships enter classlib\listimp.h in the include box for TListImp <XXX> class.  XXX
represents the class names of the objects in the collection, e.g. Passenger.  If desired change TListImp in this
script with TArray with classlib\arrays.h, TStack with classlib\stacks.h, TBag with classlib\bags.h.
NO_OUTPUT_END

// Class: CLASS_NAME                  //Borland C++ 4.X

#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$CLASS_NAME$_H  //Required for current class
  #define __$CAPITALIZE_ALL$TRUNCATE_EIGHT$CLASS_NAME$_H

#ifndef __IOSTREAM_H            //Required for cin and cout
  #include <iostream.h>                 
#endif
[                               //Required for base classes
#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$BASE_CLASS$_H
  #include "TRUNCATE_EIGHT$BASE_CLASS$.h"
#endif]                               
[#include <INCLUDE_FILE>//Required for include files,eg <classlib\listimp.h>]
[                               //Required for 1:1 associated classes
#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$ASSOCIATION_ONE_CLASS$_H
  #include "TRUNCATE_EIGHT$ASSOCIATION_ONE_CLASS.h"
#endif]                                                               
[                               //Required for 1:1 aggregation (part) classes
#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$AGGREGATION_ONE_CLASS$_H
  #include "TRUNCATE_EIGHT$AGGREGATION_ONE_CLASS$.h"
#endif]                                                               
[                               //Required for 1:M associated classes
#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$ASSOCIATION_MANY_CLASS$_H
  #include "TRUNCATE_EIGHT$ASSOCIATION_MANY_CLASS$.h"
#endif]                                                               
[                               //Required for 1:M aggregation (part) classes
#ifndef __$CAPITALIZE_ALL$TRUNCATE_EIGHT$AGGREGATION_MANY_CLASS$_H
  #include "TRUNCATE_EIGHT$AGGREGATION_MANY_CLASS$.h"
#endif]
class CLASS_NAME[NO_RETURN NO_REPEAT: NO_REPEAT public BASE_CLASS ,DELETE_LAST_SYMBOL] CLASS_LIBRARY_BASE_CLASS      
{ [ATTRIBUTE_TYPE ATTRIBUTE_NAME$;]
  [ASSOCIATION_ONE_CLASS$* ASSOCIATION_ONE_NAME$;]
  [AGGREGATION_ONE_CLASS AGGREGATION_ONE_NAME$;]
  [TListImp <ASSOCIATION_MANY_CLASS> ASSOCIATION_MANY_NAME$;]
  [TListImp <AGGREGATION_MANY_CLASS> AGGREGATION_MANY_NAME$;]
public:
			//Default constructor
			//Update to access base class attributes 
			//Update to access 1:1 part class attributes 
			//Update to access 1:M part class attributes
			//Update to access 1:1 associated class attributes
			//Update to access 1:M associated class attributes
			//Ensure initial values entered
  CLASS_NAME () :[NO_RETURN ATTRIBUTE_NAME(ATTRIBUTE_INITIAL_VALUE),DELETE_LAST_SYMBOL]  { } 

			//Constructor with arguments
  CLASS_NAME ([NO_RETURN ATTRIBUTE_TYPE a$ATTRIBUTE_NAME,DELETE_LAST_SYMBOL] )       
  : [NO_RETURN ATTRIBUTE_NAME (a$ATTRIBUTE_NAME),DELETE_LAST_SYMBOL] { }        
			
			//Copy constructor
			//Update to access 1:M part class attributes
			//Update to access 1:1 associated class attributes
			//Update to access 1:M associated class attributes      
  CLASS_NAME (const CLASS_NAME$& a$CLASS_NAME ) [NO_RETURN NO_REPEAT: BASE_CLASS (a$CLASS_NAME),DELETE_LAST_SYMBOL]
  { [  ATTRIBUTE_NAME = a$CLASS_NAME$.$ATTRIBUTE_NAME;]
    [AGGREGATION_ONE_NAME = a$CLASS_NAME$.$AGGREGATION_ONE_NAME;]            
  }                                     

			//Operator= Assignment Operator
			//Update to access 1:M part class attributes
			//Update to access 1:1 associated class attributes
			//Update to access 1:M associated class attributes      
  CLASS_NAME operator= (const CLASS_NAME$& a$CLASS_NAME)
  { if (this == &a$CLASS_NAME) return *this;          
  [BASE_CLASS$::operator= (a$CLASS_NAME);]
  [ATTRIBUTE_NAME = a$CLASS_NAME$.$ATTRIBUTE_NAME;]
  [AGGREGATION_ONE_NAME = a$CLASS_NAME$.$AGGREGATION_ONE_NAME;]      
  return *this;                                                                                                 
  }                                     

			//Operator== Equality Operator
			//Update to access 1:M part class attributes
			//Update to access 1:1 associated class attributes
			//Update to access 1:M associated class attributes      
  int operator== (const CLASS_NAME$& a$CLASS_NAME)
  { return (
[  (BASE_CLASS$::operator== (a$CLASS_NAME)) &&]
[  (AGGREGATION_ONE_NAME == a$CLASS_NAME$.$AGGREGATION_ONE_NAME) &&]
[  (ATTRIBUTE_NAME == a$CLASS_NAME$.ATTRIBUTE_NAME) &DELETE_LAST_SYMBOL&DELETE_LAST_SYMBOL]
  );
  }                             
	
			//Operator<< for cout 
  friend ostream& operator<< (ostream& os, CLASS_NAME$& a$CLASS_NAME);

			//Operator<< for cin
  friend istream& operator>> (istream& is, CLASS_NAME$& a$CLASS_NAME);
			
[                       //Get accessor function for attribute
  ATTRIBUTE_TYPE get$ATTRIBUTE_NAME$() const
  {return ATTRIBUTE_NAME$;
  }
]                       
[                       //Set accessor function for attribute
  void set$ATTRIBUTE_NAME ($ATTRIBUTE_TYPE a$ATTRIBUTE_NAME$)
  { ATTRIBUTE_NAME = a$ATTRIBUTE_NAME$;
  }
]                       
[                       //Get accessor function for 1:1 aggregation
  AGGREGATION_ONE_CLASS$& get$AGGREGATION_ONE_NAME$() 
  {return AGGREGATION_ONE_NAME$;
  }
]                       
[                       //Set accessor function for 1:1 aggregation
  void set$AGGREGATION_ONE_NAME ($AGGREGATION_ONE_CLASS$& a$AGGREGATION_ONE_NAME$)
  { AGGREGATION_ONE_NAME = a$AGGREGATION_ONE_NAME$;
  }
]                       
[                       //Get accessor function for 1:1 association
  ASSOCIATION_ONE_CLASS$* get$ASSOCIATION_ONE_NAME$() const
  {return ASSOCIATION_ONE_NAME$;
  }
]                       
[                       //Set accessor function for 1:1 association
  void set$ASSOCIATION_ONE_NAME ($ASSOCIATION_ONE_CLASS$* a$ASSOCIATION_ONE_NAME$)
  { ASSOCIATION_ONE_NAME = a$ASSOCIATION_ONE_NAME$;
  }
]
[  CPP_OPERATION_VIRTUAL CPP_OPERATION_STATIC OPERATION_RETURN_TYPE OPERATION_NAME (CPP_OPERATION_PARAMETERS) CPP_OPERATION_CONSTANT CPP_OPERATION_PURE_VIRTUAL;
] 
  OPERATION_CPP_VIRTUAL_BASE_CLASS ~ CLASS_NAME ( ) { }       //Destructor
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?