summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorKrishna Keshav <princy.krishnakeshav@gmail.com>2016-05-11 03:42:21 +0530
committerMichael Meeks <michael.meeks@collabora.com>2016-05-12 13:01:52 +0000
commitaa74c30eddaa72a2c000f46e01d3ef3611dd98fa (patch)
tree723303527d1150a8760adfc356a4330a1dd74849 /lingucomponent
parent1d54b93670ac2c40661e3890ecea987d334cba31 (diff)
Removed 'altstrfunc.cxx' and .hxx
renamed and moved 'start()' to it's only call site - as 'startsAsciiCaseInsensitive' lingucomponent/source/languageguessing/simpleguesser.cxx. moved inline bool to it's only call site - as 'isSeparator(const char)' from altstrfunc.hxx to lingucomponent/source/languageguessing/guess.cxx. Change-Id: Ic624ba3cab90bd454311219966c19fb550388da1 Reviewed-on: https://gerrit.libreoffice.org/24864 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/Library_guesslang.mk1
-rw-r--r--lingucomponent/source/languageguessing/altstrfunc.cxx42
-rw-r--r--lingucomponent/source/languageguessing/altstrfunc.hxx34
-rw-r--r--lingucomponent/source/languageguessing/guess.cxx7
-rw-r--r--lingucomponent/source/languageguessing/simpleguesser.cxx19
5 files changed, 23 insertions, 80 deletions
diff --git a/lingucomponent/Library_guesslang.mk b/lingucomponent/Library_guesslang.mk
index ee8c4e4370aa..c8ee6ec026df 100644
--- a/lingucomponent/Library_guesslang.mk
+++ b/lingucomponent/Library_guesslang.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_Library_use_libraries,guesslang,\
))
$(eval $(call gb_Library_add_exception_objects,guesslang,\
- lingucomponent/source/languageguessing/altstrfunc \
lingucomponent/source/languageguessing/guess \
lingucomponent/source/languageguessing/guesslang \
lingucomponent/source/languageguessing/simpleguesser \
diff --git a/lingucomponent/source/languageguessing/altstrfunc.cxx b/lingucomponent/source/languageguessing/altstrfunc.cxx
deleted file mode 100644
index a155ee026885..000000000000
--- a/lingucomponent/source/languageguessing/altstrfunc.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * 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 .
- */
-
-#include "altstrfunc.hxx"
-
-#include <sal/types.h>
-#include<rtl/character.hxx>
-
-using namespace rtl;
-
-int start(const std::string &s1, const std::string &s2){
- size_t i;
- int ret = 0;
-
- size_t min = s1.length();
- if (min > s2.length())
- min = s2.length();
-
- for(i = 0; i < min && s2[i] && s1[i] && !ret; i++){
- ret = toAsciiUpperCase(s1[i]) - toAsciiUpperCase(s2[i]);
- if(s1[i] == '.' || s2[i] == '.'){ret = 0;}//. is a neutral character
- }
- return ret;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/languageguessing/altstrfunc.hxx b/lingucomponent/source/languageguessing/altstrfunc.hxx
deleted file mode 100644
index c6d879d5bd42..000000000000
--- a/lingucomponent/source/languageguessing/altstrfunc.hxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * 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 .
- */
-
-#ifndef INCLUDED_LINGUCOMPONENT_SOURCE_LANGUAGEGUESSING_ALTSTRFUNC_HXX
-#define INCLUDED_LINGUCOMPONENT_SOURCE_LANGUAGEGUESSING_ALTSTRFUNC_HXX
-
-#include <string>
-#include <guess.hxx>
-
-inline bool isSeparator(const char c){
- return c == GUESS_SEPARATOR_OPEN || c == GUESS_SEPARATOR_SEP || c == GUESS_SEPARATOR_CLOSE || c == '\0';
-}
-
-int start(const std::string &s1, const std::string &s2);
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/languageguessing/guess.cxx b/lingucomponent/source/languageguessing/guess.cxx
index 9d1751e96741..76358917120f 100644
--- a/lingucomponent/source/languageguessing/guess.cxx
+++ b/lingucomponent/source/languageguessing/guess.cxx
@@ -25,7 +25,7 @@
#else
#include <textcat.h>
#endif
-#include <altstrfunc.hxx>
+
#include <guess.hxx>
/* Old textcat.h versions defined bad spelled constants. */
@@ -39,6 +39,11 @@
using namespace std;
+inline bool isSeparator(const char c){
+ return c == GUESS_SEPARATOR_OPEN || c == GUESS_SEPARATOR_SEP || c == GUESS_SEPARATOR_CLOSE || c == '\0';
+}
+
+
Guess::Guess()
: language_str(DEFAULT_LANGUAGE)
, country_str(DEFAULT_COUNTRY)
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 5d7caec5a6c0..9fef4a402dbb 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -47,11 +47,26 @@
#include <sal/types.h>
-#include "altstrfunc.hxx"
+#include<rtl/character.hxx>
#include "simpleguesser.hxx"
using namespace std;
+static int startsAsciiCaseInsensitive(const std::string &s1, const std::string &s2){
+ size_t i;
+ int ret = 0;
+
+ size_t min = s1.length();
+ if (min > s2.length())
+ min = s2.length();
+
+ for(i = 0; i < min && s2[i] && s1[i] && !ret; i++){
+ ret = rtl::toAsciiUpperCase(s1[i]) - rtl::toAsciiUpperCase(s2[i]);
+ if(s1[i] == '.' || s2[i] == '.') {ret = 0;} //. is a neutral character
+ }
+ return ret;
+ }
+
/**
* This 3 following structures are from fingerprint.c and textcat.c
*/
@@ -197,7 +212,7 @@ void SimpleGuesser::XableLanguage(const string& lang, char mask)
for (size_t i=0; i<tables->size; i++)
{
string language(fp_Name(tables->fprint[i]));
- if (start(language,lang) == 0)
+ if (startsAsciiCaseInsensitive(language,lang) == 0)
tables->fprint_disable[i] = mask;
}
}