http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/8bdc0dde/framework/ext-qnx/cordova/echo/public/tokenizer.h ---------------------------------------------------------------------- diff --git a/framework/ext-qnx/cordova/echo/public/tokenizer.h b/framework/ext-qnx/cordova/echo/public/tokenizer.h deleted file mode 100644 index 75f567c..0000000 --- a/framework/ext-qnx/cordova/echo/public/tokenizer.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************ -The zlib/libpng License - -Copyright (c) 2006 Joerg Wiedenmann - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; - you must not claim that you wrote the original software. - If you use this software in a product, an acknowledgment - in the product documentation would be appreciated but is - not required. - -2. Altered source versions must be plainly marked as such, - and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - -***********************************************************************/ - -/******************************************************************** - created: 2006-01-28 - filename: tokenizer.cpp - author: J�rg Wiedenmann - - purpose: A tokenizer function which provides a very - customizable way of breaking up strings. -*********************************************************************/ - -#include <vector> -#include <string> -using namespace std; - -// Function to break up a string into tokens -// -// Parameters: -//----------- -// str = the input string that will be tokenized -// result = the tokens for str -// delimiters = the delimiter characters -// delimiters preserve = same as above, but the delimiter characters -// will be put into the result as a token -// quote = characters to protect the enclosed characters -// esc = characters to protect a single character -// - -void tokenize ( const string& str, vector<string>& result, - const string& delimiters, const string& delimiters_preserve = "", - const string& quote = "\"", const string& esc = "\\" );
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/8bdc0dde/framework/ext-qnx/cordova/echo/src/echo.cpp ---------------------------------------------------------------------- diff --git a/framework/ext-qnx/cordova/echo/src/echo.cpp b/framework/ext-qnx/cordova/echo/src/echo.cpp deleted file mode 100644 index bc11a69..0000000 --- a/framework/ext-qnx/cordova/echo/src/echo.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - - -#include <../public/json/reader.h> -#include <string> -#include <sstream> -#include <sys/stat.h> -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include "echo.hpp" - -using namespace std; - -/** - * Default constructor. - */ -Echo::Echo(const std::string& id) : m_id(id) { -} - -/** - * Memory destructor. - */ -Echo::~Echo() { -} - -/** - * This method returns the list of objects implemented by this native - * extension. - */ -char* onGetObjList() { - static char name[] = "Echo"; - return name; -} - -/** - * This method is used by JNext to instantiate the Memory object when - * an object is created on the JavaScript server side. - */ -JSExt* onCreateObject(const string& className, const string& id) { - if (className == "Echo") { - return new Echo(id); - } - - return NULL; -} - -/** - * Method used by JNext to determine if the object can be deleted. - */ -bool Echo::CanDelete() { - return true; -} - -/** - * It will be called from JNext JavaScript side with passed string. - * This method implements the interface for the JavaScript to native binding - * for invoking native code. This method is triggered when JNext.invoke is - * called on the JavaScript side with this native objects id. - */ -string Echo::InvokeMethod(const string& command) { - int index = command.find_first_of(" "); - std::string method = command.substr(0, index); - - // read in arguments - Json::Value obj; - if (command.length() > index) { - std::string jsonObject = command.substr(index + 1, command.length()); - Json::Reader reader; - - bool parse = reader.parse(jsonObject, obj); - if (!parse) { - fprintf(stderr, "%s", "error parsing\n"); - return "Cannot parse JSON object"; - } - } - - // Determine which function should be executed - if (method == "doEcho") { - // will this work? - if(obj["message"] != NULL) { - return doEcho(obj["message"].asString()); - }else{ - return doEcho("Nothing to echo."); - } - }else{ - return doEcho("Unsupported Method"); - } -} - -/** - * Method that sends off Event message - */ -string Echo::doEcho(const std::string& message) { - std::string eventString = m_id; - eventString.append(" "); - eventString.append("cordova.echo.callback"); - eventString.append(" "); - eventString.append(message); - SendPluginEvent(eventString.c_str(), m_pContext); - return eventString; -} http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/8bdc0dde/framework/ext-qnx/cordova/echo/src/echo.hpp ---------------------------------------------------------------------- diff --git a/framework/ext-qnx/cordova/echo/src/echo.hpp b/framework/ext-qnx/cordova/echo/src/echo.hpp deleted file mode 100644 index 408be69..0000000 --- a/framework/ext-qnx/cordova/echo/src/echo.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -#ifndef ECHO_HPP_ -#define ECHO_HPP_ - -#include <string> -#include <pthread.h> -#include "../public/plugin.h" - -class Echo: public JSExt { - -public: - explicit Echo(const std::string& id); - virtual ~Echo(); - -// Interfaces of JSExt - virtual bool CanDelete(); - virtual std::string InvokeMethod(const std::string& command); - -private: - std::string doEcho(const std::string& message); - - std::string m_id; -}; - -#endif /* ECHO_HPP_ */
