C++ naming::examples::soft



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_soft.hpp-- >>

#ifde Dh_my_class_soft
                       // 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_soft          // global class.  prefix(( GC_ ))
      {
      public:
        typedef N_type T_type;     // typedef.  prefix(( T_ ))  
        typedef Ni_int T_int;      // typedef.  prefix(( T_ )) 

        enum Ee_some_enums              // enum-name.  prefix(( Ee_ )) 
         { 
          En_FIRST, En_last, En_Third   // enumerator.  prefix(( En_ ))  
         }; 
 
        class C_sub_class               // sub class.  prefix(( C_ ))  
         {
          public:
           //...
         };

        GC_my_class_soft(){}
       ~GC_my_class_soft(){} 

               int    F_run(    T_type const& P_in   );   // plain.     prefix(( F_ ))
       virtual float  Fv_do(    T_type *      P_out  );   // virtual.   prefix(( Fv_ ))  
       static  char   Fs_dance( T_type *      P_io   );   // static.    prefix(( Fs_ ))

               T_type M_data_personal;  // plain.    prefix(( M_ ))  
       static  T_type Ms_data_common;   // static.   prefix(( Ms_ ))  

       protected:


       private:
        
     };


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

  typedef GC_my_class_soft< int> GT_my_class_soft_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_soft.hpp-- >>

<< BEGIN OF FILE --my_class_soft.cpp-- >> #include <iostream> #include "my_class_soft.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_soft GTs_my_class_soft_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_soft< N_type,Ni_int,Nt_ttt>::F_run( T_type const& P_in ) { 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_soft< N_type,Ni_int,Nt_ttt>::Fv_do( T_type * P_out ) { 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_soft< N_type,Ni_int,Nt_ttt>::Fs_dance( T_type * P_io ) { #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_soft.cpp-- >>