svn propset svn:eol-style native

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@426586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-07-28 16:04:03 +00:00
parent d44765df12
commit 34f3c8c65a
1 changed files with 148 additions and 148 deletions

View File

@ -1,149 +1,149 @@
/** /**
* *
* Copyright 2005-2006 The Apache Software Foundation * Copyright 2005-2006 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import org.apache.activemq.openwire.tool.OpenWireCppHeadersScript import org.apache.activemq.openwire.tool.OpenWireCppHeadersScript
/** /**
* Generates the C++ commands for the Open Wire Format * Generates the C++ commands for the Open Wire Format
* *
* @version $Revision$ * @version $Revision$
*/ */
class GenerateCppHeaders extends OpenWireCppHeadersScript { class GenerateCppHeaders extends OpenWireCppHeadersScript {
void generateFile(PrintWriter out) { void generateFile(PrintWriter out) {
out << """/* out << """/*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef ${className}_hpp_ #ifndef ${className}_hpp_
#define ${className}_hpp_ #define ${className}_hpp_
#include <string> #include <string>
""" """
if( baseClass.equals("BrokerError") ) if( baseClass.equals("BrokerError") )
out << """#include "${baseClass}.hpp" out << """#include "${baseClass}.hpp"
""" """
else else
out << """#include "command/${baseClass}.hpp" out << """#include "command/${baseClass}.hpp"
""" """
for (property in properties) for (property in properties)
{ {
if( !property.type.isPrimitiveType() && if( !property.type.isPrimitiveType() &&
property.type.simpleName != "String" && property.type.simpleName != "String" &&
property.type.simpleName != "ByteSequence" ) property.type.simpleName != "ByteSequence" )
{ {
def includeName = toCppType(property.type) def includeName = toCppType(property.type)
if( property.type.isArrayType() ) if( property.type.isArrayType() )
{ {
def arrayType = property.type.arrayComponentType ; def arrayType = property.type.arrayComponentType ;
if( arrayType.isPrimitiveType() ) if( arrayType.isPrimitiveType() )
continue ; continue ;
} }
if( includeName.startsWith("ap<") ) if( includeName.startsWith("ap<") )
includeName = includeName.substring(3, includeName.length()-1) ; includeName = includeName.substring(3, includeName.length()-1) ;
else if( includeName.startsWith("p<") ) else if( includeName.startsWith("p<") )
includeName = includeName.substring(2, includeName.length()-1) includeName = includeName.substring(2, includeName.length()-1)
if( includeName.equals("BrokerError") ) if( includeName.equals("BrokerError") )
out << """#include "${includeName}.hpp" out << """#include "${includeName}.hpp"
""" """
else else
out << """#include "command/${includeName}.hpp" out << """#include "command/${includeName}.hpp"
""" """
} }
} }
out << """ out << """
#include "util/ifr/ap.hpp" #include "util/ifr/ap.hpp"
#include "util/ifr/p.hpp" #include "util/ifr/p.hpp"
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client namespace client
{ {
namespace command namespace command
{ {
using namespace ifr; using namespace ifr;
using namespace std; using namespace std;
using namespace apache::activemq::client; using namespace apache::activemq::client;
/* /*
* *
* Marshalling code for Open Wire Format for ${className} * Marshalling code for Open Wire Format for ${className}
* *
* *
* NOTE!: This file is autogenerated - do not modify! * NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the * if you need to make a change, please see the Groovy scripts in the
* activemq-core module * activemq-core module
* *
*/ */
class ${className} : public ${baseClass} class ${className} : public ${baseClass}
{ {
private: private:
""" """
for (property in properties) { for (property in properties) {
def type = toCppType(property.type) def type = toCppType(property.type)
def name = decapitalize(property.simpleName) def name = decapitalize(property.simpleName)
out << """ $type $name ; out << """ $type $name ;
""" """
} }
out << """ out << """
public: public:
const static int TYPE = ${getOpenWireOpCode(jclass)}; const static int TYPE = ${getOpenWireOpCode(jclass)};
public: public:
${className}() ; ${className}() ;
virtual ~${className}() ; virtual ~${className}() ;
virtual int getCommandType() ; virtual int getCommandType() ;
""" """
for (property in properties) { for (property in properties) {
def type = toCppType(property.type) def type = toCppType(property.type)
def propertyName = property.simpleName def propertyName = property.simpleName
def parameterName = decapitalize(propertyName) def parameterName = decapitalize(propertyName)
out << """ out << """
virtual ${type} get${propertyName}() ; virtual ${type} get${propertyName}() ;
virtual void set${propertyName}(${type} ${parameterName}) ; virtual void set${propertyName}(${type} ${parameterName}) ;
""" """
} }
out << """ out << """
} ; } ;
/* namespace */ /* namespace */
} }
} }
} }
} }
#endif /*${className}_hpp_*/ #endif /*${className}_hpp_*/
""" """
} }
} }