Пример #1
0
void UmlOperation::rename_jdk5() {
  QCString s;
  bool changed = FALSE;
  bool javasettings = (parent()->name() == "JavaSettings");
  
  s = cppDecl();
  if (rename(s, FALSE, javasettings)) {
    changed = TRUE;
    set_CppDecl(s);
  }
  
  s = cppDef();
  if (rename(s, FALSE, javasettings)) {
    changed = TRUE;
    set_CppDef(s);
  }
  
  s = cppBody();
  if (rename(s, FALSE, javasettings)) {
    changed = TRUE;
    set_CppBody(s);
  }
  
  s = javaDef();
  if (rename(s, TRUE, javasettings)) {
    changed = TRUE;
    set_JavaDef(s);
  }
  
  s = javaBody();
  if (rename(s, TRUE, javasettings)) {
    changed = TRUE;
    set_JavaBody(s);
  }
  
  if (changed)
    UmlCom::trace(parent()->name() + "::" + name() +
		  " upgraded to take into account the rename of 'enum' to 'enum pattern'<br>\n");
  
}
Пример #2
0
// p0 is the beginning of the operation's def
// p point to ${body}
// indent is the one of the operation
const char * UmlOperation::generate_body(QTextStream & f,
        WrapperStr indent,
        const char * p)
{
    if(isAbstract())
        return p + 7;

    const char * body = 0;
    WrapperStr modeler_body;
    bool no_indent;
    char s_id[9];

    if (preserve() && !isBodyGenerationForced()) {
        unsigned id = get_id();

        sprintf(s_id, "%08X", id);
        body = bodies.find((long) id);
    }

    if (body == 0) {
        no_indent = !javaContextualBodyIndent();
        modeler_body = javaBody();	// to not free the string
        body = modeler_body;
    }
    else
        // body from file, respect its indent
        no_indent = TRUE;

    // get keyword indent
    WrapperStr bindent = indent;

    while (*p != '$')
        bindent += *p++;

    if (preserve() && !isBodyGenerationForced())
        f << bindent << BodyPrefix << s_id << '\n';

    if ((body != 0) && (*body != 0)) {
        // output body
        if (bindent.isEmpty() || no_indent) {
            f << body;
            body += strlen(body);
        }
        else {
            f << bindent;

            while (*body) {
                f << *body;

                if (*body++ == '\n') {
                    if (*body == 0)
                        break;

                    f << bindent;
                }
            }
        }

        if (body[-1] != '\n')
            f << '\n';
    }

    if (preserve() && !isBodyGenerationForced())
        f << bindent << BodyPostfix << s_id << '\n';

    f << indent;	// for the }

    return p + 7;
}