Example #1
0
      /// static functions for the suite
      template<class T> static OfxStatus propGetN(OfxPropertySetHandle properties,
                                            const char *property,
                                            int count,
                                            typename T::APIType *values) {
#       ifdef OFX_DEBUG_PROPERTIES
        std::cout << "OFX: propGetN - " << properties << ' ' << property << "[0.." << count-1 << "] = ...";
#       endif
        try {
          Set *thisSet = reinterpret_cast<Set*>(properties);
          if(!thisSet || !thisSet->verifyMagic()) {
#           ifdef OFX_DEBUG_PROPERTIES
            std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl;
#           endif
            return kOfxStatErrBadHandle;
          }
          PropertyTemplate<T> *prop = 0;
          if(!thisSet->fetchTypedProperty(property, prop, true)) {
#           ifdef OFX_DEBUG_PROPERTIES
            std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl;
#           endif
            return kOfxStatErrUnknown;
          }
          prop->getValueN(values, count);
#         ifdef OFX_DEBUG_PROPERTIES
          for (int i = 0; i < count; ++i) {
            if (i != 0) {
                std::cout << ',';
            }
            std::cout << values[i];
          }
          std::cout << ' ' << StatStr(kOfxStatOK) << std::endl;
#         endif
        } catch (const Exception& e) {
#         ifdef OFX_DEBUG_PROPERTIES
          std::cout << ' ' << StatStr(e.getStatus()) << std::endl;
#         endif
          return e.getStatus();
        } catch (...) {
#         ifdef OFX_DEBUG_PROPERTIES
          std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl;
#         endif
          return kOfxStatErrUnknown;
        }
        return kOfxStatOK;
      }
Example #2
0
      /// static functions for the suite
      template<class T> static OfxStatus propGet(OfxPropertySetHandle properties,
                                               const char *property,
                                               int index,
                                               typename T::APIType *value) {
#       ifdef OFX_DEBUG_PROPERTIES
        std::cout << "OFX: propGet - " << properties << ' ' << property << "[" << index << "] = ...";
#       endif
        try {
          Set *thisSet = reinterpret_cast<Set*>(properties);
          if(!thisSet || !thisSet->verifyMagic()) {
#           ifdef OFX_DEBUG_PROPERTIES
            std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl;
#           endif
            return kOfxStatErrBadHandle;
          }
          PropertyTemplate<T> *prop = 0;
          if(!thisSet->fetchTypedProperty(property, prop, true)) {
#           ifdef OFX_DEBUG_PROPERTIES
            std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl;
#           endif
            return kOfxStatErrUnknown;
          }
          *value = castToAPIType(prop->getValue(index));

#         ifdef OFX_DEBUG_PROPERTIES
          std::cout << *value << ' ' << StatStr(kOfxStatOK) << std::endl;
#         endif
        } catch (const Exception& e) {
#         ifdef OFX_DEBUG_PROPERTIES
          std::cout << ' ' << StatStr(e.getStatus()) << std::endl;
#         endif
          return e.getStatus();
        } catch (...) {
#         ifdef OFX_DEBUG_PROPERTIES
          std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl;
#         endif
          return kOfxStatErrUnknown;
        }
        return kOfxStatOK;
      }