Changeset 42 for trunk/gsdl/src
- Timestamp:
- 1998-12-01T14:32:41+13:00 (26 years ago)
- Location:
- trunk/gsdl/src/library
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/library/gdbmclass.cpp
r37 r42 688 688 } 689 689 690 void string_free (char **array, int len) {690 void string_free (char **array, int len) { 691 691 for (int i = 0; i < len; i++) 692 692 free (array[i]); 693 693 free (array); 694 694 } 695 696 // returns a date of form _dec_ 31, 1999 697 // input is date of type 19991231 698 // at least the year must be present in date 699 text_t format_date (const text_t &date) { 700 text_t::const_iterator here = date.begin(); 701 text_t::const_iterator end = date.end(); 702 703 text_t year, month, day, dreturn; 704 705 for (int i = 0; i < 4; i++) { 706 year.push_back(*here); 707 here ++; 708 } 709 if (year.empty()) return ""; 710 711 for (i = 0; (i < 2 && here != end); i++) { 712 month.push_back(*here); 713 here ++; 714 } 715 for (i = 0; (i < 2 && here != end); i++) { 716 day.push_back(*here); 717 here ++; 718 } 719 720 if (!month.empty()) { 721 if (month == "01") month = "_jan_"; 722 else if (month == "02") month = "_feb_"; 723 else if (month == "03") month = "_mar_"; 724 else if (month == "04") month = "_apr_"; 725 else if (month == "05") month = "_may_"; 726 else if (month == "06") month = "_jun_"; 727 else if (month == "07") month = "_jul_"; 728 else if (month == "08") month = "_aug_"; 729 else if (month == "09") month = "_sep_"; 730 else if (month == "10") month = "_oct_"; 731 else if (month == "11") month = "_nov_"; 732 else if (month == "12") month = "_dec_"; 733 else month.clear(); 734 } 735 736 if (!day.empty()) { 737 if (day[0] == '0') { 738 char tmp = day[1]; 739 day.clear(); 740 day.push_back(tmp); 741 } 742 } 743 744 if (!month.empty()) { 745 dreturn += month + " "; 746 if (!day.empty()) { 747 dreturn += day + ", "; 748 } 749 } 750 dreturn += year; 751 return dreturn; 752 } -
trunk/gsdl/src/library/gdbmclass.h
r22 r42 27 27 text_t o; 28 28 text_t a; 29 text_t s; 30 text_t i; 29 31 30 32 void clear (); … … 89 91 static int compare_str (const void *e1, const void *e2); 90 92 void string_free(char **array, int len); 93 text_t format_date (const text_t &date); 91 94 #endif
Note:
See TracChangeset
for help on using the changeset viewer.