File: test_precomp.cpp

package info (click to toggle)
opencv 2.4.9.1%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 126,800 kB
  • ctags: 62,729
  • sloc: xml: 509,055; cpp: 490,794; lisp: 23,208; python: 21,174; java: 19,317; ansic: 1,038; sh: 128; makefile: 72
file content (24 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "test_precomp.hpp"

cv::String cv::Path::combine(const String& item1, const String& item2)
{
    if (item1.empty())
        return item2;

    if (item2.empty())
        return item1;

    char last = item1[item1.size()-1];

    bool need_append = last != '/' && last != '\\';
    return item1 + (need_append ? "/" : "") + item2;
}

cv::String cv::Path::combine(const String& item1, const String& item2, const String& item3)
{ return combine(combine(item1, item2), item3); }

cv::String cv::Path::change_extension(const String& file, const String& ext)
{
    String::size_type pos = file.find_last_of('.');
    return pos == String::npos ? file : file.substr(0, pos+1) + ext;
}