Esempio n. 1
0
//! Sets the node to the given filepath.
//! \note This function uses `SHCreateItemFromParsingName()`, which is limited to `MAX_PATH` (260) chars.
bool ShellNodeInfo::setNode(QString filepath)
{
    wchar_t converted[MAX_PATH] = {'\0'};
    // maybe some day
    /*
    auto converted = QVarLengthArray<wchar_t, MAX_PATH>();
    if (filepath.length() > MAX_PATH) {
        if (!filepath.startsWith(detail::longPathPrefix))
            filepath.prepend(detail::longPathPrefix);
        converted.reserve(filepath.length());
    }*/
    if (filepath.length() > MAX_PATH - 1) {
        qDebug() << "Can't add paths longer than 260 literals to the shell.";
        d.reset();
        return false;
    }

    //Actually copy the string
    Q_ASSERT(filepath.toWCharArray(converted) > 0);

    auto item = ShellItem2Pointer();
    SHCreateItemFromParsingName(converted, nullptr, IID_PPV_ARGS(item.addressOf()));
    if (!item) {
        qDebug() << "Failed to create NodeInfo from path: " << filepath;
        return false;
    }
    d = ShellNodeData::create(item);
    refresh();
    return true;
}
Esempio n. 2
0
 inline void set(int i, int j, const T& val) { *addressOf(i,j) = val; }
Esempio n. 3
0
 inline T& get(int i, int j) { return *addressOf(i,j); }
Esempio n. 4
0
 inline T get(int i, int j) const { return *addressOf(i,j); }
Esempio n. 5
0
 inline T get(int i) const { return *addressOf(i); }
Esempio n. 6
0
 inline void set(int i, const T& val) { *addressOf(i) = val; }
Esempio n. 7
0
 inline T& get(int i) { return *addressOf(i); }
Esempio n. 8
0
 ///////////////////////////////////////////////////////////
 /// Get the increment (in number of Reals) from one element
 /// to the next.
 ///////////////////////////////////////////////////////////
 int incr() const { return int(addressOf(1) - addressOf(0)); }
Esempio n. 9
0
 const T* begin() const { return addressOf(0); }
Esempio n. 10
0
 T* begin() { return addressOf(0); }
Esempio n. 11
0
int * Table::lookup(const string &key) {

  return addressOf(hashTable[hashCode(key)],key);

}