COOPY » Guide
version 0.6.5
|
00001 #include <coopy/SheetSchema.h> 00002 #include <coopy/Stringer.h> 00003 00004 using namespace coopy::store; 00005 00006 using namespace std; 00007 00008 SheetSchema *SheetSchema::clone() const { 00009 SimpleSheetSchema *ss = new SimpleSheetSchema(); 00010 if (ss==NULL) return ss; 00011 ss->setHeaderHeight(headerHeight()); 00012 ss->setSheetName(getSheetName().c_str()); 00013 for (int i=0; i<getColumnCount(); i++) { 00014 ColumnInfo inf = getColumnInfo(i); 00015 ss->addColumn(inf.getName().c_str(),inf.getColumnType()); 00016 } 00017 return ss; 00018 } 00019 00020 00021 std::string SimpleSheetSchema::toString() const { 00022 std::string r = ""; 00023 r += "sheet "; 00024 r += getSheetName(); 00025 r += " header height "; 00026 int h = headerHeight(); 00027 if (h>0) { 00028 r += ">0"; 00029 } else if (h==0) { 00030 r += "=0"; 00031 } else { 00032 r += "<0"; 00033 } 00034 r += " columns "; 00035 r += stringer_encoder(getColumnCount()); 00036 r += " ("; 00037 for (int i=0; i<getColumnCount(); i++) { 00038 if (i>0) r += ", "; 00039 r += getColumnInfo(i).getName(); 00040 } 00041 r += ")"; 00042 return r; 00043 } 00044