Browse Source

Gmt module: Base2Something raise error flag if initialized by pointer of incompatible type.

Some small changes.
ObjPtr
Michael Uleysky 9 years ago
parent
commit
f1d960a769
  1. 12
      modules/gmt/modgmt_func.cpp

12
modules/gmt/modgmt_func.cpp

@ -22,7 +22,11 @@ class Base2Something: public OBTypeM<Func,O...>
Base2Something(const ObjectBase* arg):OBTypeM<Func,O...>(arg) {}; Base2Something(const ObjectBase* arg):OBTypeM<Func,O...>(arg) {};
Base2Something(const ObjectList* input, const std::string& name):OBTypeM<Func,O...>(input->Get(name)){}; Base2Something(const ObjectList* input, const std::string& name):OBTypeM<Func,O...>(input->Get(name)){};
Base2Something(const ObjectList* input, const ObjectList::ListValues::size_type i):OBTypeM<Func,O...>((i<input->Size())?input->At(i):0){}; // Check index, because At is not safe Base2Something(const ObjectList* input, const ObjectList::ListValues::size_type i):OBTypeM<Func,O...>((i<input->Size())?input->At(i):0){}; // Check index, because At is not safe
auto operator ()(bool* b) const -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*>(b)) {return OBTypeM<Func,O...>::operator ()(b);} auto operator ()(bool* b) const -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*>(b))
{
if(!OBTypeM<Func,O...>::operator bool()) *b=false;
return OBTypeM<Func,O...>::operator ()(b);
}
}; };
// Converting Int, Real or String to double // Converting Int, Real or String to double
@ -226,8 +230,7 @@ class ProjConv<ObjectList>
if(proj) return p=proj->Data(); // Case 1 if(proj) return p=proj->Data(); // Case 1
OBType<ObjectList> list(arg); OBType<ObjectList> list(arg);
if(list) return p=operator()(list,issuc); // Case 2 if(list) return p=operator()(list,issuc); // Case 2
*issuc=false; goto fail; // Conversion failed
return p; // Conversion failed
} }
// Case 3 // Case 3
@ -834,8 +837,7 @@ ObjectString can be number or in form "dd:mm[:ss]", where dd is degrees from -36
ObjectBase* GMT_Coord(const ObjectList* input) ObjectBase* GMT_Coord(const ObjectList* input)
{ {
if(input->Size()!=1) return 0; if(input->Size()!=1) return 0;
const ObjectBase *arg=input->At(0); Base2Coord a(input,0);
Base2Coord a(arg);
struct gmt_coord c; struct gmt_coord c;
bool suc=true; bool suc=true;

Loading…
Cancel
Save