1 #ifndef OPENSIM_PROPERTY_STR_H_ 2 #define OPENSIM_PROPERTY_STR_H_ 3 /* -------------------------------------------------------------------------- * 4 * OpenSim: PropertyStr.h * 5 * -------------------------------------------------------------------------- * 6 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation. * 7 * See http://opensim.stanford.edu and the NOTICE file for more information. * 8 * OpenSim is developed at Stanford University and supported by the US * 9 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA * 10 * through the Warrior Web program. * 11 * * 12 * Copyright (c) 2005-2017 Stanford University and the Authors * 13 * Author(s): Frank C. Anderson * 14 * * 15 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 16 * not use this file except in compliance with the License. You may obtain a * 17 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 18 * * 19 * Unless required by applicable law or agreed to in writing, software * 20 * distributed under the License is distributed on an "AS IS" BASIS, * 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 22 * See the License for the specific language governing permissions and * 23 * limitations under the License. * 24 * -------------------------------------------------------------------------- */ 25 26 /* Note: This code was originally developed by Realistic Dynamics Inc. 27 * Author: Frank C. Anderson 28 */ 29 30 31 // INCLUDES 32 #include "osimCommonDLL.h" 33 #include <string> 34 #include "Property_Deprecated.h" 35 36 37 //============================================================================= 38 //============================================================================= 39 namespace OpenSim { 40 41 /** 42 * Class PropertyStr extends class Property. It consists of a string 43 * value and the methods for accessing and modifying this value. 44 * 45 * @version 1.0 46 * @author Frank C. Anderson 47 */ 48 class OSIMCOMMON_API PropertyStr : public Property_Deprecated 49 { 50 //============================================================================= 51 // DATA 52 //============================================================================= 53 private: 54 /** Value. */ 55 std::string _value; 56 57 //============================================================================= 58 // METHODS 59 //============================================================================= 60 //-------------------------------------------------------------------------- 61 // CONSTRUCTION 62 //-------------------------------------------------------------------------- 63 public: 64 PropertyStr(); 65 PropertyStr(const std::string &aName, 66 const std::string &aValue); 67 PropertyStr(const PropertyStr &aProperty); 68 PropertyStr* clone() const override; 69 70 //-------------------------------------------------------------------------- 71 // OPERATORS 72 //-------------------------------------------------------------------------- 73 public: 74 #ifndef SWIG 75 PropertyStr& operator=(const PropertyStr &aProperty); 76 #endif 77 void assign(const AbstractProperty& that) override; 78 79 //-------------------------------------------------------------------------- 80 // GET AND SET 81 //-------------------------------------------------------------------------- 82 public: 83 // TYPE 84 std::string getTypeName() const override; 85 // VALUE 86 void setValue(const std::string &aValue) override; 87 #ifndef SWIG 88 std::string& getValueStr() override; 89 #endif 90 const std::string& getValueStr() const override; 91 // VALUE as String 92 std::string toString() const override; 93 94 // Special method to reset the value clearValue()95 void clearValue() { _value = getDefaultStr(); setValueIsDefault(true); } 96 static const std::string& getDefaultStr(); 97 isValidFileName()98 bool isValidFileName() const { return _value!="" && _value!=getDefaultStr(); } 99 100 //============================================================================= 101 }; // END of class PropertyStr 102 103 }; //namespace 104 //============================================================================= 105 //============================================================================= 106 107 #endif // OPENSIM_PROPERTY_STR_H_ 108