Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/Units_Token.lxx is written in an unsupported language. File is not indexed.

0001 // Created on: 1992-06-24
0002 // Created by: Gilles DEBARBOUILLE
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #include <stdio.h>
0018 #include <string.h>
0019 #include <Standard_Macro.hxx>
0020 #include <iostream>
0021 #include <iomanip>
0022 #include <fstream>
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Units_Dimensions.hxx>
0025 
0026 //=================================================================================================
0027 
0028 inline TCollection_AsciiString Units_Token::Word() const
0029 {
0030   return theword;
0031 }
0032 
0033 //=================================================================================================
0034 
0035 inline TCollection_AsciiString Units_Token::Mean() const
0036 {
0037   return themean;
0038 }
0039 
0040 //=================================================================================================
0041 
0042 inline double Units_Token::Value() const
0043 {
0044   return thevalue;
0045 }
0046 
0047 //=================================================================================================
0048 
0049 inline occ::handle<Units_Dimensions> Units_Token::Dimensions() const
0050 {
0051   return thedimensions;
0052 }
0053 
0054 //=================================================================================================
0055 
0056 inline void Units_Token::Word(const char* const aword)
0057 {
0058   theword = aword;
0059 }
0060 
0061 //=================================================================================================
0062 
0063 inline void Units_Token::Mean(const char* const amean)
0064 {
0065   themean = amean;
0066 }
0067 
0068 //=================================================================================================
0069 
0070 inline void Units_Token::Value(const double avalue)
0071 {
0072   thevalue = avalue;
0073 }
0074 
0075 //=================================================================================================
0076 
0077 inline bool Units_Token::IsNotEqual(const char* const astring) const
0078 {
0079   TCollection_AsciiString string = Word();
0080   int                     length = string.Length();
0081   if (strlen(astring) == (unsigned int)length)
0082     return strncmp(string.ToCString(), astring, unsigned(length)) != 0;
0083   else
0084     return true;
0085 }
0086 
0087 //=================================================================================================
0088 
0089 inline bool Units_Token::IsNotEqual(const occ::handle<Units_Token>& atoken) const
0090 {
0091   TCollection_AsciiString string1 = Word();
0092   TCollection_AsciiString string2 = atoken->Word();
0093   int                     length  = string1.Length();
0094   if (length == atoken->Length())
0095     return strcmp(string1.ToCString(), string2.ToCString()) != 0;
0096   else
0097     return true;
0098 }
0099 
0100 //=================================================================================================
0101 
0102 inline bool Units_Token::IsLessOrEqual(const char* const astring) const
0103 {
0104   TCollection_AsciiString string = Word();
0105   int                     length = string.Length();
0106   if (strlen(astring) >= (unsigned int)length)
0107     return strncmp(string.ToCString(), astring, unsigned(length)) == 0;
0108   else
0109     return false;
0110 }
0111 
0112 //=================================================================================================
0113 
0114 inline bool Units_Token::IsGreater(const char* const astring) const
0115 {
0116   TCollection_AsciiString string = Word();
0117   int                     length = string.Length();
0118   return strncmp(string.ToCString(), astring, unsigned(length)) > 0;
0119 }
0120 
0121 //=================================================================================================
0122 
0123 inline bool Units_Token::IsGreater(const occ::handle<Units_Token>& atoken) const
0124 {
0125   TCollection_AsciiString string1 = Word();
0126   TCollection_AsciiString string2 = atoken->Word();
0127   int                     length  = string1.Length();
0128   return strncmp(string1.ToCString(), string2.ToCString(), unsigned(length)) > 0;
0129 }
0130 
0131 //=================================================================================================
0132 
0133 inline bool Units_Token::IsGreaterOrEqual(const occ::handle<Units_Token>& atoken) const
0134 {
0135   TCollection_AsciiString string1 = Word();
0136   TCollection_AsciiString string2 = atoken->Word();
0137   int                     length  = string1.Length();
0138   return strncmp(string1.ToCString(), string2.ToCString(), unsigned(length)) >= 0;
0139 }