// Created on: 1992-06-24 // Created by: Gilles DEBARBOUILLE // Copyright (c) 1992-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include //======================================================================= //function : Word //purpose : //======================================================================= inline TCollection_AsciiString Units_Token::Word() const { return theword; } //======================================================================= //function : Mean //purpose : //======================================================================= inline TCollection_AsciiString Units_Token::Mean() const { return themean; } //======================================================================= //function : Value //purpose : //======================================================================= inline Standard_Real Units_Token::Value() const { return thevalue; } //======================================================================= //function : Dimensions //purpose : //======================================================================= inline Handle(Units_Dimensions) Units_Token::Dimensions() const { return thedimensions; } //======================================================================= //function : Word //purpose : //======================================================================= inline void Units_Token::Word(const Standard_CString aword) { theword = aword; } //======================================================================= //function : Mean //purpose : //======================================================================= inline void Units_Token::Mean(const Standard_CString amean) { themean = amean; } //======================================================================= //function : Value //purpose : //======================================================================= inline void Units_Token::Value(const Standard_Real avalue) { thevalue = avalue; } //======================================================================= //function : IsNotEqual //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsNotEqual (const Standard_CString astring) const { TCollection_AsciiString string = Word(); Standard_Integer length = string.Length(); if(strlen(astring) == (unsigned int ) length) return (strncmp(string.ToCString(),astring,unsigned(length)) != 0) ? Standard_True : Standard_False; else return Standard_True; } //======================================================================= //function : IsNotEqual //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsNotEqual (const Handle(Units_Token)& atoken) const { TCollection_AsciiString string1 = Word(); TCollection_AsciiString string2 = atoken->Word(); Standard_Integer length = string1.Length(); if(length == atoken->Length()) return (strcmp(string1.ToCString(),string2.ToCString()) != 0) ? Standard_True : Standard_False; else return Standard_True; } //======================================================================= //function : IsLessOrEqual //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsLessOrEqual (const Standard_CString astring) const { TCollection_AsciiString string = Word(); Standard_Integer length = string.Length(); if(strlen(astring) >= (unsigned int ) length) return (strncmp(string.ToCString(),astring,unsigned(length)) == 0) ? Standard_True : Standard_False; else return Standard_False; } //======================================================================= //function : IsGreater //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsGreater (const Standard_CString astring) const { TCollection_AsciiString string = Word(); Standard_Integer length = string.Length(); return (strncmp(string.ToCString(),astring,unsigned(length)) > 0) ? Standard_True : Standard_False; } //======================================================================= //function : IsGreater //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsGreater (const Handle(Units_Token)& atoken) const { TCollection_AsciiString string1 = Word(); TCollection_AsciiString string2 = atoken->Word(); Standard_Integer length = string1.Length(); return (strncmp(string1.ToCString(),string2.ToCString(),unsigned(length)) > 0) ? Standard_True : Standard_False; } //======================================================================= //function : IsGreaterOrEqual //purpose : //======================================================================= inline Standard_Boolean Units_Token::IsGreaterOrEqual (const Handle(Units_Token)& atoken) const { TCollection_AsciiString string1 = Word(); TCollection_AsciiString string2 = atoken->Word(); Standard_Integer length = string1.Length(); return (strncmp(string1.ToCString(),string2.ToCString(),unsigned(length)) >= 0) ? Standard_True : Standard_False; }