C++ naming::examples::hard_extreme


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 enum-number.  prefix(( En0_ ))  
         }; 
 
        class C0_sub_class               // public sub class.  prefix(( C0_ ))  
         {
          public:
           //...
         };


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

                const T_type M0c_data_personal;  // public const           prefix(( M0c_ ))  
        static  const T_type M0sc_data_common;   // public static const.   prefix(( M0sc_ ))  


         GC_my_class_hard_extreme(){}
        ~GC_my_class_hard_extreme 

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

                int    F0c_run(    T_type const& Pi_in   )const;   // public const            prefix(( F0c_ ))
        virtual float  F0vc_do(    T_type *      Po_out  )const;   // public virtual const.   prefix(( F0vc_ ))  


       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.         prefix(( M1s_ ))  

                const T_type M1c_data_personal;  // protected const           prefix(( M1c_ ))  
        static  const T_type M1sc_data_common;   // protected static const.   prefix(( M1sc_ ))  

                int    F1c_run(    T_type const& Pi_in   )const;   // protected  const            prefix(( F1c_ ))
        virtual float  F1vc_do(    T_type *      Po_out  )const;   // protected  virtual const.   prefix(( F1vc_ ))  


                int    F1_run(    T_type const& Pi_in   );   // protected plain function.     prefix(( F1_ )) 
        virtual float  F1v_do(    T_type *      Po_out  );   // protected virtual.            prefix(( F1v_ ))  
        static  char   F1s_dance( T_type *      P_io   );    // protected static.             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 enum-number.  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.          prefix(( M2s_ ))  

                const T_type M2c_data_personal;  // private const           prefix(( M2c_ ))  
        static  const T_type M2sc_data_common;   // private static const.   prefix(( M2sc_ ))  


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

                int    F2c_run(    T_type const& Pi_in   )const;   // private const            prefix(( F2c_ ))
        virtual float  F2vc_do(    T_type *      Po_out  )const;   // private virtual const.   prefix(( F2vc_ ))  
     };


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

   typedef GC_my_class_hard_extreme< int> GT_my_class_hard_extreme_INT;          // global typedef.         prefix(( GT_ ))
  
   extern float                           GI_spec_value;                         // global instace.         prefix(( GI_ ))          
   extern float                           GIc_some_fixed_value;                  // global const instace.   prefix(( GIc_ ))          

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

  }

#endif

<< END OF FILE --my_class_hard_extreme.hpp-- >>

<< BEGIN OF FILE --my_class_hard_extreme.cpp-- >> #include <iostream> #include "my_class_hard_extreme.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_extreme GTs_my_class_hard_extreme_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: //... }; int GIs_spec_local_value=123; // local instance prefix(( GIs_ )) 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_extreme< 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_extreme< 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_extreme< 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 iside a function. prefix(( Cf_ ) { public: //... }; return 1; } << END OF FILE --my_class_hard_extreme.cpp-- >>