/* * $Id: misc.h,v 1.2 2004/11/04 17:39:52 ozawa Exp $ * * Copyright 2003- ONGS Inc. All rights reserved. * * author: Masanori OZAWA (ozawa@ongs.co.jp) * version: $Revision: 1.2 $ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ONGS INC ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL ONGS INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are * those of the authors and should not be interpreted as representing official * policies, either expressed or implied, of the ONGS Inc. * */ #ifndef ___MISC_H #define ___MISC_H #ifndef __cplusplus #define __cplusplus #endif #include "glib.h" /** * ユーザのホームディレクトリへのパスを取得します。 * * @return ユーザのホームディレクトリへのパス。 * 取得したパスの改変/解放はしないでください。 */ extern const char* getHomeDir(); /** * アプリケーション用のディレクトリへのパスを取得します。 * * @param pAppName アプリケーション名を指定します(NULL Terminated) * @return アプリケーション用のディレクトリへのパス。 * ディレクトリ名の終端は pAppName の終端と同じです。 * 取得したパスの改変/解放はしないでください。 */ extern const char* getAppDir(const char *pAppName); /** * 付箋紙用のディレクトリが存在しない場合は、新規に構築します。 */ extern void createFusenshiDir(); /** * 新規付箋紙ファイル名を取得します。 * * @return 新規付箋紙ファイルのファイル名。 * ファイルの構築は行いません。 * 不要になったタイミングで free() してください。 */ extern char* createNewFusenshiFileName(); /** * 文字列の前後の空白を除去します。 * * @param szSrc 除去する前の文字列 * @return 前後の空白を除去した文字列 */ extern Glib::ustring strTrim(Glib::ustring& szSrc); /** * 文字列の前の空白を除去します。 * * @param szSrc 除去する前の文字列 * @return 前の空白を除去した文字列 */ extern Glib::ustring strTrimLeft(Glib::ustring& szSrc); /** * 文字列の後の空白を除去します。 * * @param szSrc 除去する前の文字列 * @return 後の空白を除去した文字列 */ extern Glib::ustring strTrimRight(Glib::ustring& szSrc); /** * IPアドレスの文字列表現を取得します。 * * @param nAddr IPアドレス * @return IPアドレスの文字列表現。 */ extern Glib::ustring IP2STR(long nAddr); /** * 文字列から色を生成し、設定します。 * * @param pColor GdkColor構造体 * @param pValue 色情報を保持する文字列 * @return 設定に成功した場合は true を戻す。 */ extern bool string2color(GdkColor *pColor, const char *pValue); /** * 色を表現する文字列を取得します。 * * @param pColor GdkColor構造体 * @param szBuffer 色文字列を格納するバッファ */ extern void color2string(const GdkColor *pColor, Glib::ustring& szBuffer); #endif