Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd48963b authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Add CommandExecutor for dicttoolkit.

Bug: 10059681
Change-Id: I90334caaf37c84ce7d1b93d12efbfb5f244a9420
parent 4bfa3b27
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,12 @@ LATIN_IME_DICT_TOOLKIT_MAIN_SRC_FILES := \
    dict_toolkit_main.cpp

LATIN_IME_DICT_TOOLKIT_SRC_FILES := \
    $(addprefix command_executors/, \
        diff_executor.cpp \
        header_executor.cpp \
        help_executor.cpp \
        info_executor.cpp \
        makedict_executor.cpp) \
    utils/command_utils.cpp

LATIN_IME_DICT_TOOLKIT_TEST_FILES := \
+4 −5
Original line number Diff line number Diff line
@@ -26,15 +26,14 @@ void usage(int argc, char **argv) {
int main(int argc, char **argv) {
    if (argc < MIN_ARG_COUNT) {
        usage(argc, argv);
        return 0;
        return 1;
    }
    using namespace latinime::dicttoolkit;
    const CommandType commandType = CommandUtils::getCommandType(argv[1]);
    if (commandType == CommandType::Unknown) {
        CommandUtils::printCommandUnknownMessage(argv[0], argv[1]);
        return 0;
        return 1;
    }
    // TODO: Implement.
    fprintf(stderr, "Command '%s' has not been implemented yet.\n", argv[1]);
    return 0;
    const auto executor = CommandUtils::getCommandExecutor(commandType);
    return executor(argc - 1, argv + 1);
}
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed 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 "command_executors/diff_executor.h"

#include <cstdio>

namespace latinime {
namespace dicttoolkit {

const char *const DiffExecutor::COMMAND_NAME = "diff";

/* static */ int DiffExecutor::run(const int argc, char **argv) {
    fprintf(stderr, "Command '%s' has not been implemented yet.\n", COMMAND_NAME);
    return 0;
}

} // namespace dicttoolkit
} // namespace latinime
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed 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 LATINIME_DICT_TOOLKIT_DIFF_EXECUTOR_H
#define LATINIME_DICT_TOOLKIT_DIFF_EXECUTOR_H

#include "dict_toolkit_defines.h"

namespace latinime {
namespace dicttoolkit {

class DiffExecutor final {
 public:
    static const char *const COMMAND_NAME;

    static int run(const int argc, char **argv);

 private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(DiffExecutor);
};

} // namespace dicttoolkit
} // namepsace latinime
#endif // LATINIME_DICT_TOOLKIT_DIFF_EXECUTOR_H
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed 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 "command_executors/header_executor.h"

#include <cstdio>

namespace latinime {
namespace dicttoolkit {

const char *const HeaderExecutor::COMMAND_NAME = "header";

/* static */ int HeaderExecutor::run(const int argc, char **argv) {
    fprintf(stderr, "Command '%s' has not been implemented yet.\n", COMMAND_NAME);
    return 0;
}

} // namespace dicttoolkit
} // namespace latinime
Loading