kio Library: KRemoteEncoding Class Reference (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KRemoteEncoding Class Reference

Allows encoding and decoding properly remote filenames into Unicode. A class for handling remote filenames. More...

`#include <kremoteencoding.h>`

Collaboration diagram for KRemoteEncoding:

[legend]
List of all members.

## Public Member Functions
| KRemoteEncoding (const char *name=0L)
virtual | ~KRemoteEncoding ()
QString | decode (const QCString &name) const
QCString | encode (const QString &name) const
QCString | encode (const KURL &url) const
QCString | directory (const KURL &url, bool ignore_trailing_slash=true) const
QCString | fileName (const KURL &url) const
const char * | encoding () const
void | setEncoding (const char *name)
## Protected Member Functions
virtual void | virtual_hook (int id, void *data)
## Protected Attributes
QTextCodec * | codec

## Detailed Description

Allows encoding and decoding properly remote filenames into Unicode. A class for handling remote filenames.

Certain protocols do not specify an appropriate encoding for decoding their 8-bit data into proper Unicode forms. Therefore, ioslaves should use this class in order to convert those forms into QStrings before creating the respective KIO::UDSEntry. The same is true for decoding URLs to its components.

Each KIO::SlaveBase has one object of this kind, even if it is not necessary. It can be accessed through KIO::SlaveBase::remoteEncoding.

Author:
  Thiago Macieira <thiago.macieira@kdemail.net>

Since:
  3.3

Definition at line 44 of file kremoteencoding.h.

## Constructor & Destructor Documentation

KRemoteEncoding::KRemoteEncoding | ( | const char * | name = `0L` | ) | `[explicit]`

| Constructor. Constructs this object to use the given encoding name. If `name` is a null pointer, the standard encoding will be used. Definition at line 25 of file kremoteencoding.cpp. References setEncoding().

KRemoteEncoding::~KRemoteEncoding | ( |  | ) | `[virtual]`

| Destructor. Definition at line 31 of file kremoteencoding.cpp.

## Member Function Documentation

QString KRemoteEncoding::decode | ( | const QCString & | name | ) | const

| Converts the given full pathname or filename to Unicode. This function is supposed to work for dirnames, filenames or a full pathname. Definition at line 36 of file kremoteencoding.cpp. References QString::fromLatin1(), QTextCodec::fromUnicode(), KStringHandler::isUtf8(), QTextCodec::mibEnum(), and QTextCodec::toUnicode().

QCString KRemoteEncoding::encode | ( | const QString & | name | ) | const

| Converts the given name from Unicode. This function is supposed to work for dirnames, filenames or a full pathname. Definition at line 51 of file kremoteencoding.cpp. References QTextCodec::fromUnicode(), QString::latin1(), and QTextCodec::toUnicode(). Referenced by directory(), encode(), and fileName().

QCString KRemoteEncoding::encode | ( | const KURL & | url | ) | const

| Converts the given URL into its 8-bit components. Definition at line 60 of file kremoteencoding.cpp. References encode().

QCString KRemoteEncoding::directory | ( | const KURL & | url,
|  | bool | ignore_trailing_slash = `true`
| ) | const

| Converts the given URL into 8-bit form and separate the dirname from the filename. This is useful for slave functions like stat or get. The dirname is returned with the final slash always stripped Definition at line 65 of file kremoteencoding.cpp. References encode().

QCString KRemoteEncoding::fileName | ( | const KURL & | url | ) | const

| Converts the given URL into 8-bit form and retrieve the filename. Definition at line 72 of file kremoteencoding.cpp. References encode().

const char* KRemoteEncoding::encoding | ( |  | ) | const`[inline]`

| Returns the encoding being used. Definition at line 96 of file kremoteencoding.h.

void KRemoteEncoding::setEncoding | ( | const char * | name | ) |

| Sets the encoding being used. This function does not change the global configuration. Pass a null pointer in `name` to revert to the standard encoding. Definition at line 77 of file kremoteencoding.cpp. References QTextCodec::codecForMib(), QTextCodec::codecForName(), endl(), k_funcinfo, kdDebug(), and QTextCodec::name(). Referenced by KRemoteEncoding().

The documentation for this class was generated from the following files:

- kremoteencoding.h
- kremoteencoding.cpp

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:25:12 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003