path.cpp

来自「linux subdivision ying gai ke yi le ba」· C++ 代码 · 共 113 行

CPP
113
字号
/**
 * @copyright
 * ====================================================================
 * Copyright (c) 2003 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 * @endcopyright
 *
 * @file Path.cpp
 * @brief Implementation of the class Path
 */

#include "Path.h"
#include "svn_path.h"
#include "JNIUtil.h"
#include "Pool.h"

/**
 * Constructor
 *
 * @see Path::Path (const std::string &)
 * @param path Path string
 */
Path::Path (const char * path)
{
    init (path);
}

/**
 * Constructor that takes a string as parameter.
 * The string is converted to subversion internal
 * representation. The string is copied.
 *
 * @param path Path string
 */
Path::Path (const std::string & path)
{
    init (path.c_str ());
}

/**
 * Copy constructor
 *
 * @param path Path to be copied
 */
Path::Path (const Path & path)
{
    init (path.c_str ());
}

/**
 * initialize the class
 *
 * @param path Path string
 */
void
Path::init (const char * path)
{
    if(*path == 0)
    {
        m_path = "";
    }
    else
    {
        m_error_occured = JNIUtil::preprocessPath(path, 
            JNIUtil::getRequestPool()->pool() );

        m_path = path;
    }
}

/**
 * @return Path string
 */
const std::string &
Path::path () const
{
    return m_path;
}

/**
 * @return Path string as c string
 */
const char *
Path::c_str() const
{
    return m_path.c_str ();
}

/**
 * Assignment operator
 */
Path&
Path::operator=(const Path & path)
{
    init (path.c_str ());
    return *this;
}

svn_error_t *Path::error_occured() const
{
    return m_error_occured;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?