| 1861 | |
| 1862 | |
| 1863 | cString* cDirectInterpretASTVisitor::asString(const sASTypeInfo& type, uAnyType value, cASTNode& node) |
| 1864 | { |
| 1865 | switch (type.type) { |
| 1866 | case TYPE(BOOL): return new cString(cStringUtil::Convert(value.as_bool)); |
| 1867 | case TYPE(CHAR): { cString* str = new cString(1); (*str)[0] = value.as_char; return str; } |
| 1868 | case TYPE(INT): return new cString(cStringUtil::Convert(value.as_int)); |
| 1869 | case TYPE(FLOAT): return new cString(cStringUtil::Convert(value.as_float)); |
| 1870 | case TYPE(STRING): return value.as_string; |
| 1871 | |
| 1872 | case TYPE(ARRAY): |
| 1873 | { |
| 1874 | cString* str = new cString(cStringUtil::Stringf("< array(%d) >", value.as_array->GetSize())); |
| 1875 | value.as_array->RemoveReference(); |
| 1876 | return str; |
| 1877 | } |
| 1878 | |
| 1879 | case TYPE(DICT): |
| 1880 | { |
| 1881 | cString* str = new cString(cStringUtil::Stringf("< dict(%d) >", value.as_dict->GetSize())); |
| 1882 | value.as_dict->RemoveReference(); |
| 1883 | return str; |
| 1884 | } |
| 1885 | |
| 1886 | case TYPE(MATRIX): |
| 1887 | { |
| 1888 | cString* str = new cString(cStringUtil::Stringf("< matrix(%d, %d) >", value.as_matrix->GetNumRows(), value.as_matrix->GetNumCols())); |
| 1889 | return str; |
| 1890 | } |
| 1891 | |
| 1892 | case TYPE(OBJECT_REF): |
| 1893 | { |
| 1894 | cString* str = new cString(cStringUtil::Stringf("< %s object @ %p >", value.as_nobj->GetType(), value.as_nobj)); |
| 1895 | return str; |
| 1896 | } |
| 1897 | |
| 1898 | default: |
| 1899 | INTERPRET_ERROR(TYPE_CAST, mapType(type), mapType(TYPE(STRING))); |
| 1900 | } |
| 1901 | |
| 1902 | return NULL; |
| 1903 | } |
| 1904 | |
| 1905 | |
| 1906 |
nothing calls this directly
no test coverage detected