// KDate.cpp : implementation file // #include "stdafx.h" #include "KDate.h" //#include "KBEditors.h" CKDate::CKDate(CString str1) { str = str1; } CKDate::~CKDate() { } BOOL CKDate::s0() { return s1(0); } BOOL CKDate::s1(int pos) { return (str[pos]=='(' && pos < str.GetLength()&&(s4(pos+1) || s2(pos+1))); } BOOL CKDate::s2(int pos) { return (IsNumber(str[pos]) && pos < str.GetLength() &&(s2(pos+1) || s3(pos+1))); } BOOL CKDate::s3(int pos) { return ((str[pos]=='+'||str[pos]=='-') && pos < str.GetLength() && s4(pos+1) ); } BOOL CKDate::s4(int pos) { return (str[pos]=='#' && pos < str.GetLength()&& s5(pos+1) ); } BOOL CKDate::s5(int pos) { return (IsNumber(str[pos]) && pos < str.GetLength()&& (s6(pos+1)||s7(pos+1)) ); } BOOL CKDate::s6(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& s7(pos+1) ); } BOOL CKDate::s7(int pos) { return (str[pos]=='/' &&pos < str.GetLength()&& s8(pos+1) ); } BOOL CKDate::s8(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& (s9(pos+1)||s10(pos+1)) ); } BOOL CKDate::s9(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& s10(pos+1)); } BOOL CKDate::s10(int pos) { return (str[pos]=='/' && pos < str.GetLength() && s11(pos+1) ); } BOOL CKDate::s11(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& s12(pos+1)); } BOOL CKDate::s12(int pos) { return (IsNumber(str[pos]) && pos < str.GetLength()&& (s13(pos+1)||s15(pos+1))); } BOOL CKDate::s13(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& s14(pos+1)); } BOOL CKDate::s14(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& s15(pos+1)); } BOOL CKDate::s15(int pos) { if (str[0] != '(') return(str[0] == '#'||IsNumber(str[0])); else return(str[pos]=='#' && pos < str.GetLength()&&(s16(pos+1)||s17(pos+1))); } BOOL CKDate::s16(int pos) { return (str[pos]== ')'); } BOOL CKDate::s17(int pos) { return ((str[pos]=='+'||str[pos]=='-') && pos < str.GetLength()&& s18(pos+1) ); } BOOL CKDate::s18(int pos) { return (IsNumber(str[pos]) &&pos < str.GetLength()&& (s18(pos+1)||s16(pos+1))); } BOOL CKDate::IsNumber(char a) { return (a =='0' ||a =='1' ||a =='2' ||a =='3' ||a =='4' ||a =='5' ||a =='6' ||a =='7' ||a =='8' ||a =='9'); }