#include <ndk++.h>
Inheritance diagram for NDK_XX::Application:
Public Methods | |
virtual | ~Application () |
StatusBar * | getStatusBar () |
string | get_title () const |
void | set_param_file_name (const string &file_name) |
Tell us what is the name of the parameters file. | |
string | get_param_file_name () const |
Retrive the parameters file name. | |
string | get_param (const string §ion_name,const string &key_name,const string &val) |
Find a string parameter (a la MS's .ini files). | |
long | get_param (const string §ion_name,const string &key_name,long val) |
Find a numeric parameter (a la MS's .ini files). | |
string | save_param (const string §ion_name,const string &key_name,const string &val) |
Save a string parameter (a la MS's .ini files). | |
long | save_param (const string §ion_name,const string &key_name,long val) |
Save a numeric parameter (a la MS's .ini files). | |
Static Public Methods | |
Application * | get_application () |
Protected Methods | |
Application (bool wantColors=FALSE) | |
virtual void | activateMenuBar ()=0 |
virtual void | activateStatusBar () |
bool | section_exists (ifstream ¶m_file, const string §ion_name) |
Helper to check if a section given in ge/save_param functs. exists. | |
long | find_key (ifstream ¶m_file, const string §ion_name,const string &key_name, string &value) |
Helper to check if a key given in ge/save_param functs. exists. | |
Protected Attributes | |
string | app_title |
StatusBar * | pStatusBar |
string | param_file_name |
|
Definition at line 2096 of file ndk++.h. References NDK_XX::Exception< T >::Exception(), and NDK_XX::Exception< T >::pElem. Referenced by TestApplication::TestApplication().
02097 : public NCursesException 02098 { 02099 public: |
|
Definition at line 2113 of file ndk++.h. References NDK_XX::Exception< T >::pElem.
02114 :
02115 NCursesException ("NDK++ library exception", err),
|
|
Implemented in TestApplication. |
|
Definition at line 2606 of file ndk++.cc. References pStatusBar. Referenced by TestApplication::run().
02607 { 02608 pStatusBar = new StatusBar(1,COLS,LINES-1,0); 02609 02610 } |
|
Helper to check if a key given in ge/save_param functs. exists.
Definition at line 2634 of file ndk++.cc. References section_exists(). Referenced by get_param().
02636 { 02637 long line_beg =0; 02638 if(section_exists(param_file,section_name)){ 02639 string line; 02640 string found_key; 02641 char line_read[255]={0}; 02642 for( param_file.getline(line_read,sizeof(line_read)); 02643 param_file.good(); 02644 param_file.getline(line_read,sizeof(line_read))){ 02645 line = line_read; 02646 line_beg = param_file.tellg(); 02647 line_beg -= line.size(); 02648 if(line.empty() || line[0]=='#')///Skip empty and comment lines 02649 continue; 02650 if(line_read[0] == '[')///Reached the next section 02651 break; 02652 int from= line.find_first_not_of(" \t"); 02653 if(from == string::npos)//Non-empty, but all spaces... 02654 continue; 02655 int to= line.rfind("#");///allow inline comments 02656 if(to!=string::npos){ 02657 line = line.substr(from,to-from); 02658 } 02659 to= line.find_last_not_of(" \t"); 02660 line = line.substr(from,to-from+1); 02661 int eq_sign = line.find('='); 02662 found_key= line.substr(0,eq_sign); 02663 if(found_key == key_name){ 02664 if(to!=eq_sign && eq_sign!=string::npos){//no value... 02665 value= line.substr(eq_sign+1); 02666 } 02667 break; 02668 } 02669 } 02670 } 02671 return line_beg; 02672 } |
|
Definition at line 2107 of file ndk++.h. References NDK_XX::Exception< T >::pElem.
02109 : 02110 NCursesException (msg.c_str(), err), 02111 pElem (elem) |
|
Find a numeric parameter (a la MS's .ini files).
Definition at line 2693 of file ndk++.cc. References get_param().
02695 { 02696 char txt[255]={0}; 02697 ostrstream str_val(txt,sizeof(txt)); 02698 str_val << val << ends; 02699 string result = get_param(section_name,key_name, str_val.str()); 02700 return atol(result.c_str()); 02701 ; 02702 } |
|
Find a string parameter (a la MS's .ini files).
Definition at line 2676 of file ndk++.cc. References find_key(), and param_file_name. Referenced by get_param().
02678 { 02679 long pos=0; 02680 string value=val; 02681 if(!param_file_name.empty()){ 02682 ifstream param_file(param_file_name.c_str()); 02683 pos = find_key(param_file,section_name,key_name,value); 02684 if(pos && value.empty()) 02685 value=val; 02686 } 02687 02688 return value; 02689 } |
|
Retrive the parameters file name.
Definition at line 2123 of file ndk++.h.
02123 {}; |
|
Definition at line 2118 of file ndk++.h.
02120 : |
|
Definition at line 2117 of file ndk++.h.
02117 {}; |
|
Save a numeric parameter (a la MS's .ini files).
|
|
Save a string parameter (a la MS's .ini files).
|
|
Helper to check if a section given in ge/save_param functs. exists.
Definition at line 2614 of file ndk++.cc. Referenced by find_key().
02615 { 02616 string tag("[" + section_name + "]"); 02617 string line; 02618 char line_read[255]={0}; 02619 for( param_file.getline(line_read,sizeof(line_read)); 02620 param_file.good(); 02621 param_file.getline(line_read,sizeof(line_read))){ 02622 if(line_read[0] == '['){ 02623 line = line_read; 02624 if(line.find(tag)!= string::npos){ 02625 return true; 02626 } 02627 } 02628 } 02629 return false; 02630 } |
|
Tell us what is the name of the parameters file.
Definition at line 2120 of file ndk++.h. References NDK_XX::Exception< T >::pElem. Referenced by TestApplication::run().
02120 : |
|
Definition at line 2103 of file ndk++.h. Referenced by TestApplication::TestApplication(), and TestApplication::title(). |
|
Definition at line 2148 of file ndk++.h. Referenced by get_param(), and NDK_XX::PropertyDialog::on_page_selected(). |
|
Definition at line 2147 of file ndk++.h. Referenced by activateStatusBar(), and NDK_XX::PropertyDialog::on_page_selected(). |