1 /**************************************************************************** 2 * MeshLab o o * 3 * A versatile mesh processing toolbox o o * 4 * _ O _ * 5 * Copyright(C) 2005-2008 \/)\/ * 6 * Visual Computing Lab /\/| * 7 * ISTI - Italian National Research Council | * 8 * \ * 9 * All rights reserved. * 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 * for more details. * 21 * * 22 ****************************************************************************/ 23 #ifndef GLSTATE_H 24 #define GLSTATE_H 25 26 #include <QString> 27 #include <QDomElement> 28 29 /** 30 * Class to handle OpenGL state (e.g. name, OpenGL code). 31 */ 32 class GlState 33 { 34 public: GlState(QString _name,int _state,int _value)35 GlState(QString _name, int _state, int _value) : 36 name(_name), state(_state), value(_value), valid(true) 37 {} 38 GlState(QDomElement xml)39 GlState(QDomElement xml) 40 { 41 bool ok1, ok2; 42 name = xml.attribute("NAME"); 43 state = xml.attribute("STATE").toUInt(&ok1); 44 value = xml.attribute("VALUE").toUInt(&ok2); 45 valid = (xml.tagName() == "RmState" && 46 xml.attribute("API") == "OpenGL" && 47 ok1 && ok2 ); 48 } 49 isValid()50 bool isValid() { return valid; } getValue()51 int getValue() { return value; } getState()52 int getState() { return state; } getName()53 QString getName() { return name; } 54 55 private: 56 QString name; 57 int state; 58 int value; 59 bool valid; 60 }; 61 #endif /* GLSTATE_H */ 62