Exemplo n.º 1
0
// returns std::string::npos if not found.
static size_t rfindPathSep(OovStringRef const path, size_t startPos = std::string::npos)
    {
    const OovString str = path;
    size_t bpos = str.rfind('\\', startPos);
    size_t fpos = str.rfind('/', startPos);
    size_t pos = std::string::npos;
    if(bpos != std::string::npos && fpos != std::string::npos)
        {
        pos = (bpos > fpos) ? bpos : fpos;
        }
    else if(bpos != std::string::npos)
        pos = bpos;
    else if(fpos != std::string::npos)
        pos = fpos;
    return pos;
    }
Exemplo n.º 2
0
std::string ComponentTypesFile::getComponentParentName(std::string const &compName)
    {
    OovString parent = compName;
    size_t pos = parent.rfind('/');
    if(pos != OovString::npos)
        {
        parent.erase(pos);
        }
    return parent;
    }
Exemplo n.º 3
0
std::string ComponentTypesFile::getComponentChildName(std::string const &compName)
    {
    OovString child = compName;
    size_t pos = child.rfind('/');
    if(pos != OovString::npos)
        {
        child.erase(0, pos+1);
        }
    return child;
    }
Exemplo n.º 4
0
/// Use the filename to make an identifier.
static std::string makeOrigCovFn(OovStringRef const fn)
    {
    OovString covFn = fn;
    if(covFn.find("COV_") != std::string::npos)
        {
        covFn.erase(0, 4);
        }
    covFn.replaceStrs("_", "/");
    size_t pos = covFn.rfind('/');
    if(pos != std::string::npos)
        {
        covFn.replace(pos, 1, ".");
        }
    return covFn;
    }
Exemplo n.º 5
0
void CMaker::appendNames(OovStringVec const &names,
        char delim, OovString &str)
    {
    for(auto const &name : names)
        {
        str += name;
        str += delim;
        size_t startpos = str.rfind('\n');
        if(startpos == std::string::npos)
            startpos = 0;
        if(str.length() - startpos > 70)
            {
            str += "\n  ";
            }
        }
    int len = str.length();
    if(len > 0 && str[len-1] == delim)
        str.resize(len-1);
    }
Exemplo n.º 6
0
extern "C" G_MODULE_EXPORT gboolean on_StackTextview_button_press_event(GtkWidget *widget,
        GdkEvent *event, gpointer user_data)
    {
    GdkEventButton *buttEvent = reinterpret_cast<GdkEventButton *>(event);
    if(buttEvent->type == GDK_2BUTTON_PRESS)
        {
        GtkTextView *widget = GTK_TEXT_VIEW(ControlWindow::getTabView(
            ControlWindow::CT_Stack));
        OovString line = Gui::getCurrentLineText(GTK_TEXT_VIEW(widget));
        gEditor->debugSetStackFrame(line);
        size_t pos = line.rfind(' ');
        if(pos != std::string::npos)
            {
            pos++;
            line.erase(0, pos);
            }
        gEditor->gotoFileLine(line);
        }
    return false;
    }
Exemplo n.º 7
0
void ComponentTypesFile::coerceParentComponents(OovStringRef const compName)
    {
    OovString name = compName;
    while(1)
        {
        size_t pos = name.rfind('/');
        if(pos != std::string::npos)
            {
            name.erase(pos);
            }
        if(compName != name.getStr())
            {
            setComponentType(name, CT_Unknown);
            }
        if(pos == std::string::npos)
            {
            break;
            }
        }
    }