Esempio n. 1
0
int CVector<T>::operator>(const CVector<T>& Other) const {
  if (m_IContainer == Other.m_IContainer) return 0;
  if (Count() < Other.Count()) return 0;
  else if (Count() > Other.Count()) return 1;
  else 
    for (int i=0;i<Count();i++) {
      if (GetElt(i) < Other[i]) return 0;
      else if (GetElt(i) > Other[i]) return 1;
    }
  return 0;
}
Esempio n. 2
0
int CVector<T>::operator==(const CVector<T>& Other) const {
  if (m_IContainer == Other.m_IContainer) return 1;
  if (Count() != Other.Count()) return 0;
  else for (int i=0;i<Count();i++)
    if (!(GetElt(i) == Other[i])) return 0;
  return 1;
}
Esempio n. 3
0
struct tm recent_manager::encode_date(const CString& date_string){
	int day;
	int month;
	int year;
	struct tm when; time_t now;	time( &now ); when = *localtime( &now );	
	
	char sep = 0;
	if (date_string.Pos('.') >=0 ) sep = '.';
	else if (date_string.Pos('/') >= 0) sep = '/';
	else if (date_string.Pos('-') >= 0) sep = '-';  
  
	CVector<CString> Tokens; date_string.Tokenizer(sep, Tokens);
	assert(Tokens.Count()==3);
	year = Tokens[2].Val();
	month = Tokens[1].Val();
	day = Tokens[0].Val();
	
	if ((year>0)&&(year < 100)&&(year >= when.tm_year)) year = year + 1900;
	else if ((year>0)&&(year < 100)&&(year<when.tm_year)) year = year + 2000;	
	else assert((year>=0)&&(year<=100));  

	assert((month<=12)&&(month>=1));  
	day = date_string.Val();
	assert((day <= 31)&&(day >= 1));
  	
	struct tm this_day;
	this_day.tm_mday = day;
	this_day.tm_year = year;
	this_day.tm_mon = month;
	return(this_day);
}
Esempio n. 4
0
void cgi_admin_manager::add_admin(const CString& class_, const CString& category){ 
	if (class_.StrLength()&&(class_[0]!='#')) {
		CVector<CString> Tokens; category.Tokenizer('+',Tokens);
		for (int i=0;i<Tokens.Count();i++){		
			entry_manager::add_value(Tokens[i], class_, Tokens[i]);
		}
	}
}
Esempio n. 5
0
void cgi_access_manager::fill_access(const CString& container){
	nextgen_v2 hfile(container);
	
	int recompile = 0;  
	CString s;
	CVector<CString> tokens;
	
	while (!hfile.feofc()) {
		s = hfile.read_line();
		s.Tokenizer(',', tokens);
		if (tokens.Count() == 2){
			if (tokens[1][0] == ' ') {
				recompile=1;
				tokens[1].StrTrim32();
			} else tokens[1].Decrypt();
			add_access(tokens[0], tokens[1]);
		} else if (tokens.Count() > 2) cerr << "malformed token at cgi_access::fill_access() " << tokens[0] << elf;
	}
	
	if (recompile) cgi_access_write(container);  
}
Esempio n. 6
0
void cgi_admin_manager::fill_admin(void){
	equiv_file = entry_manager::make_equiv_path("admin.struct");
	nextgen_v2 hfile(equiv_file);
	CVector<CString> Tokens;
	CString s;
	while (!hfile.feofc()) {
		s = hfile.read_line();
		s.StrTrim32();	
		s.Tokenizer(',', Tokens);	
		if (Tokens.Count() == 2)
			add_admin(Tokens[0], Tokens[1]);
	}
}