C++ naming::examples::hard



Keywords: c++ naming, cpp naming, code style, code formating, coding convention.
Description: My vison of naming convention in C++ programing language.


<< BEGIN OF FILE --my_class_hard.hpp-- >>

#ifde Dh_my_class_hard
                       // Double heder preventer   prefix(( Dh_ )) 

 // Global macro as function   prefix(( D_ )) 
 // Parameter                  prefix(( DP_ )) 
 // Instance                   prefix(( DI_ )) 
 #define D_find(DP_what,DP_array)  \
  {  \
   int DI_counter;  \
   for(DI_counter = 0; DI_counter < DP_array.size(); DI_counter++ )  \
    if( DP_what == DP_array[ DI_counter ] )  \
      break; \
    if (DI_counter  < DP_array.size() ) )  \
     cout << "Is in" << endl;  \
  }                                                                    
                

 // Global macro as const   prefix(( Dc_ )) 
 #define Dc_some_const 12.3456
                    


 namespace S_some_space            // namespace.  prefix(( S_ )) ))
  {
   template < 
             typename N_type,                             // typename.  prefix(( N_ ))
             int Ni_int = 3,                              // int.       prefix(( Ni_ ))    
             template<> Nt_ttt = std::vector      // template.  prefix(( Nt_ ))
            > 
    class GC_my_class_hard          // global class.  prefix(( GC_ ))
      {
      public:
        typedef N_type T0_type;     // public typedef.  prefix(( T0_ ))  
        typedef Ni_int T0_int;      // public typedef.  prefix(( T0_ )) 

        enum Ee0_some_enums                // public enum-name.  prefix(( Ee0_ )) 
         { 
          En0_FIRST, En0_last, En0_Third   // public enumerator.  prefix(( En0_ ))  
         }; 
 
        class C0_sub_class                 // public sub class.  prefix(( C0_ ))  
         {
          public:
           //...
         };


               T_type M0_data_personal;  // public plain member.    prefix(( M0_ ))  
       static  T_type M0s_data_common;   // public static member.   prefix(( M0s_ ))  

        GC_my_class_hard(){}
       ~GC_my_class_hard(){} 

               int    F0_run(    T_type const& Pi_in  );   // public plain function.     prefix(( F0_ ))
       virtual float  F0v_do(    T_type *      Po_out );   // public virtual function.   prefix(( F0v_ ))  
       static  char   F0s_dance( T_type *      P_io   );   // public stati functionc.    prefix(( F0s_ ))

       protected:

        typedef N_type T1_type;     // protected typedef.  prefix(( T1_ ))  
        typedef Ni_int T1_int;      // protected typedef.  prefix(( T1_ )) 

        enum Ee1_some_enums                // protected enum-name.  prefix(( Ee1_ )) 
         { 
          En1_FIRST, En1_last, En1_Third   // protected enumerator.  prefix(( En1_ ))  
         }; 
 
        class C1_sub_class                 // protected sub class.  prefix(( C1_ ))  
         {
          public:
           //...
         };

               T_type M1_data_personal;  // protected plain member.    prefix(( M1_ ))  
       static  T_type M1s_data_common;   // protected static member.   prefix(( M1s_ ))  

               int    F1_run(    T_type const& Pi_in  );   // function plain function.     prefix(( F1_ )) 
       virtual float  F1v_do(    T_type *      Po_out );   // function virtual function.   prefix(( F1v_ ))  
       static  char   F1s_dance( T_type *      P_io   );    // function static function.    prefix(( F1s_ ))


       private:

        typedef N_type T2_type;     // private typedef.  prefix(( T2_ ))  
        typedef Ni_int T2_int;      // private typedef.  prefix(( T2_ )) 

        enum Ee2_some_enums                // private enum-name.  prefix(( Ee2_ )) 
         { 
          En2_FIRST, En2_last, En2_Third   // private enumerator.  prefix(( En2_ ))  
         }; 
 
        class C2_sub_class                 // private sub class.  prefix(( C2_ ))  
         {
          public:
           //...
         };


               T_type M2_data_personal;  // private plain member.    prefix(( M2_ ))  
       static  T_type M2s_data_common;   // private static member.   prefix(( M2s_ ))  

               int    F2_run(    T_type const& Pi_in  );  // private plain function.     prefix(( F2_ )) 
       virtual float  F2v_do(    T_type *      Po_out );   // private virtual function.   prefix(( F2v_ ))  
       static  char   F2s_dance( T_type *      P_io   );   // private static function.    prefix(( F2s_ ))

     };


  enum   GEe_NULL                 // global enum type.     prefix(( GEe_ ))
   {
    GEn_notNULL,  GEn_yesNULL     // global enum number.   prefix(( GEn_ ))
   };

  typedef GC_my_class_hard< int> GT_my_class_hard_INT;                  // global typedef.   prefix(( GT_ ))

  extern float                   GI_spec_value;                         // global instace.   prefix(( GI_ ))          

  extern int                     GF_free_lancer( double P_value  );     // global function.  prefix(( GF_ ))

 }


#endif
<< END OF FILE --my_class_hard.hpp-- >>

<< BEGIN OF FILE --my_class_hard.cpp-- >> #include <iostream> #include "my_class_hard.hpp" using namespace std; using namespace S_some_space; // Local macro as function prefix(( Ds_ )) #define Ds_check(a) // Local macro as const prefix(( Dsc_ )) #define Dsc_some_const 12.3456 typedef GC_my_class_hard GTs_my_class_hard_float; // local typedef. prefix(( GTs_ )) enum GEes_NULL // local enum type prefix(( GEes_ )) { GEns_notNULL, GEns_yesNULL // local enum number prefix(( GEns_ )) }; class GCs_local_class // local class prefix(( GCs_ )) { public: //... }; static int GIs_spec_local_value=123; // local instance prefix(( GIs_ )) static int GFs_local_worker( float P_value ) // local function. prefix(( GFs_ )) { typedef int Tf_word; // typedef in function. prefix(( Tf_ )) if( 0 == P_value ) goto L_end; else return 1; L_end: // label. prefix(( L_ )) return 0; } template < typename N_type, int Ni_int, template<> Nt_ttt > int GC_my_class_hard< N_type,Ni_int,Nt_ttt>::F0_run ( T_type const& Pi_in // input parameter prefix(( Pi_ )) ) { int I_index; // Ordinary instace. prefix(( I_ )) int Ir_summa; // This instance will be returned. prefix(( Ir_ )) static int Is_called=0; // Static instance. prefix(( Is_ )) Is_called++; cout<<"Is_called "<< Is_called << endl; Ir_summa = 0; for( I_index=0; I_index< Is_called; I_index ++ ) Ir_summa += I_index; return Ir_summa; } template < typename N_type, int Ni_int, template<> Nt_ttt > float GC_my_class_hard< N_type,Ni_int,Nt_ttt>::F0v_do ( T_type * Po_out // output parameter. prefix(( Po_ )) ) { enum Eef_NULL // Enum type in function prefix(( Eef_ )) { Enf_notNULL, Enf_yesNULL // Enum number in function prefix(( Enf_ )) }; return 0; } template < typename N_type, int Ni_int, template<> Nt_ttt > char GC_my_class_hard< N_type,Ni_int,Nt_ttt>::Fs_dance ( T_type * P_io // input and output parameter. prefix(( P_ )) ) { #define Df_check(a) // function macro in function. prefix(( Df_ )) #define Dfc_phi 1.234 // const macro in function prefix(( Dfc_ )) return 'i'; #undef Df_check #undef Dfc_phi } int GF_free_lancer( double P_value ) // global function prefix(( GF_ )) { class Cf_func_class // class inside a function. prefix(( Cf_ ) { public: //... }; Cf_func_class I_obj; return 1; } << END OF FILE --my_class_hard.cpp-- >>