Exemplo n.º 1
0
    //used during folder creation if parent folder is missing
    Opt<Zstring> getParentFolderPathImpl(const Zstring& itemPathImpl) const override
    {
#ifdef ZEN_WIN
        //remove trailing separator (even for C:\ root directories)
        const Zstring itemPathFmt = endsWith(itemPathImpl, FILE_NAME_SEPARATOR) ?
                                    beforeLast(itemPathImpl, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE) :
                                    itemPathImpl;

        const Zstring parentDir = beforeLast(itemPathFmt, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE);
        if (parentDir.empty())
            return NoValue();
        if (parentDir.size() == 2 && isAlpha(parentDir[0]) && parentDir[1] == L':')
            return appendSeparator(parentDir);

#elif defined ZEN_LINUX || defined ZEN_MAC
        if (itemPathImpl == "/")
            return NoValue();

        const Zstring parentDir = beforeLast(itemPathImpl, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE);
        if (parentDir.empty())
            return Zstring("/");
#endif
        return parentDir;
    }
Exemplo n.º 2
0
Arquivo: Value.cpp Projeto: krf/QOds
void
Value::CopyTo(ods::Value &v)
{
	v.type_set(type_);
	if (NoValue())
		return;
	if (IsDouble())
		v.SetDouble(*AsDouble());
	else if (IsString())
		v.SetString(*AsString());
	else if (IsCurrency())
		v.SetCurrency(*AsCurrency());
	else if (IsPercentage())
		v.SetPercentage(*AsPercentage());
	else if (IsDate())
		v.SetDate(*AsDate());
	else if (IsDuration())
		v.SetDuration(*AsDuration());
	else
		mtl_warn("Not implemented");
}