Skip to content

Instantly share code, notes, and snippets.

@edisongustavo
Created November 7, 2012 17:39
Show Gist options
  • Save edisongustavo/4033149 to your computer and use it in GitHub Desktop.
Save edisongustavo/4033149 to your computer and use it in GitHub Desktop.
struct SubCapitulo {
int indentation;
SubCapitulo[] subcapitulos;
};
void preencher_indentation(SubCapitulo[] capitulos, int indentation = 0, flattened_chapters = null) {
if (flattened_chapters == null) {
flattened_chapters = new Array();
}
for (SubCapitulo* capitulo in capitulos) {
flattened_chapters.Add(capitulo);
capitulos.indentation = indentation;
preencher_indentation(capitulo.subcapitulos, indentation+1, flattened_chapters);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment