00001 /******************************************************************************* 00002 * Copyright (c) 2006 International Business Machines Corporation 00003 * All rights reserved. This program and the accompanying materials 00004 * are made available under the terms of the Common Public License v1.0 00005 * which accompanies this distribution, and is available at 00006 * http://www.opensource.org/licenses/cpl1.0.php 00007 * 00008 * Contributors: 00009 * Douglas Sprague, Joel Wheeler - initial API and implementation 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef STILWFCS_H 00014 #define STILWFCS_H 00015 00016 #include "stilcom.h" 00017 #include "stilcomstr.h" 00018 #include <vector> 00019 00020 #include "stilentity.h" 00021 #include "stilwfcsitem.h" 00022 00023 //--------------------------------------------------------------------------- 00067 //--------------------------------------------------------------------------- 00068 class STILWFCS : public STILEntity { 00069 00070 public : 00071 00073 enum Type { UndefinedBackSlashL = -1 }; 00074 00075 // - Default constructor 00076 STILWFCS(); 00077 00078 // - Copy constructor 00079 STILWFCS(const STILWFCS&); 00080 00081 // - Destructor 00082 virtual ~STILWFCS(); 00083 00084 // - Assignment Operator 00085 STILWFCS & operator=(const STILWFCS &); 00086 00087 // - Init/reset an object 00088 void init(); 00089 00090 // - Add a WFCSItem to the list 00091 // * NOTE: May want to eventually make this private, depending on how 00092 // much the API user is going to need it down the line (should 00093 // maybe be transparent??) 00094 void addWFCSItem (const STILWFCSItem& wfcsi); 00095 00096 // - Expand the sstring, removing all /r repeats, and return it 00097 const sstring expand(void) const; 00098 00099 // - Get the backslash L count (if any) for this WFCS 00100 LONG getBackSlashLCount(void) const; 00101 00102 private: 00103 00104 // - List of STILWFCSItems. Each item represents a grouping: for example, 00105 // If the WFCS was "V { <sigref> = /r3 01 PXX0 /wNP X; } we would have: 00106 // [0] = /r3 01 00107 // [1] = PXX0 00108 // [2] = /wNP 00109 // [3] = X 00110 std::vector<STILWFCSItem> m_WFCItemList; 00111 00112 // if this WFCS has a \l then this is it's value (-1 == undefined) 00113 LONG m_backSlashLCount; 00114 }; 00115 00116 //-------------------------------------------------------------------------- 00124 //------------------------------------------------------------------------- 00125 inline void STILWFCS::addWFCSItem (const STILWFCSItem& wfcsi) { 00126 m_WFCItemList.push_back(wfcsi); 00127 if (wfcsi.getEscapeType() == STILWFCSItem::DBC) { 00128 m_backSlashLCount = atol(wfcsi.getValue().substr(2).c_str()); 00129 } 00130 } 00131 00132 //-------------------------------------------------------------------------- 00140 //------------------------------------------------------------------------- 00141 inline LONG STILWFCS::getBackSlashLCount() const { 00142 return m_backSlashLCount; 00143 } 00144 #endif