Beispiel #1
0
    void LookParseResult::reverse()
    {
        // m_options itself should NOT be reversed.
        // The individual looks
        // need to be applied in the inverse direction. But, the precedence
        // for which option to apply is to be maintained!

        for(unsigned int optionindex=0;
        optionindex<m_options.size();
        ++optionindex)
        {
            std::reverse(m_options[optionindex].begin(), m_options[optionindex].end());

            for(unsigned int tokenindex=0;
            tokenindex<m_options[optionindex].size();
            ++tokenindex)
            {
                m_options[optionindex][tokenindex].dir =
                GetInverseTransformDirection(
                    m_options[optionindex][tokenindex].dir);
            }
        }
    }
     // Add the module
     PyModule_AddObject(enclosingModule, "Constants", m);
     
 }
 
 namespace
 {
     
     PyObject * PyOCIO_Constants_GetInverseTransformDirection(PyObject * /*module*/, PyObject * args)
     {
         OCIO_PYTRY_ENTER()
         char* s = 0;
         if (!PyArg_ParseTuple(args, "s:GetInverseTransformDirection",
             &s)) return NULL;
         TransformDirection dir = TransformDirectionFromString(s);
         dir = GetInverseTransformDirection(dir);
         return PyString_FromString(TransformDirectionToString(dir));
         OCIO_PYTRY_EXIT(NULL)
     }
     
     PyObject * PyOCIO_Constants_CombineTransformDirections(PyObject * /*module*/, PyObject * args)
     {
         OCIO_PYTRY_ENTER()
         char* s1 = 0;
         char* s2 = 0;
         if (!PyArg_ParseTuple(args, "ss:CombineTransformDirections",
             &s1, &s2)) return NULL;
         TransformDirection dir1 = TransformDirectionFromString(s1);
         TransformDirection dir2 = TransformDirectionFromString(s2);
         TransformDirection dir = CombineTransformDirections(dir1, dir2);
         return PyString_FromString(TransformDirectionToString(dir));