这篇教程C++ CSTR2SYM函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CSTR2SYM函数的典型用法代码示例。如果您正苦于以下问题:C++ CSTR2SYM函数的具体用法?C++ CSTR2SYM怎么用?C++ CSTR2SYM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CSTR2SYM函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: rndr_tablecellstatic voidrndr_tablecell(struct buf *ob, const struct buf *text, int align, void *opaque){ VALUE rb_align; switch (align) { case MKD_TABLE_ALIGN_L: rb_align = CSTR2SYM("left"); break; case MKD_TABLE_ALIGN_R: rb_align = CSTR2SYM("right"); break; case MKD_TABLE_ALIGN_CENTER: rb_align = CSTR2SYM("center"); break; default: rb_align = Qnil; break; } BLOCK_CALLBACK("table_cell", 2, buf2str(text), rb_align);}
开发者ID:SachaG,项目名称:redcarpet,代码行数:25,
示例2: rb_git_conflict_add/* * call-seq: * index.conflict_add(conflict) -> nil * * Add or update index entries that represent a conflict. * * +conflict+ has to be a hash containing +:ancestor+, +:ours+ and * +:theirs+ key/value pairs. Any of those paris can be +nil+ (or left out) * to indicate that the file was not present in the respective tree during * the merge. */static VALUE rb_git_conflict_add(VALUE self, VALUE rb_conflict){ VALUE rb_ancestor, rb_ours, rb_theirs; git_index *index; git_index_entry ancestor, ours, theirs; int error; Check_Type(rb_conflict, T_HASH); rb_ancestor = rb_hash_aref(rb_conflict, CSTR2SYM("ancestor")); rb_ours = rb_hash_aref(rb_conflict, CSTR2SYM("ours")); rb_theirs = rb_hash_aref(rb_conflict, CSTR2SYM("theirs")); if (!NIL_P(rb_ancestor)) rb_git_indexentry_toC(&ancestor, rb_ancestor); if (!NIL_P(rb_ours)) rb_git_indexentry_toC(&ours, rb_ours); if (!NIL_P(rb_theirs)) rb_git_indexentry_toC(&theirs, rb_theirs); Data_Get_Struct(self, git_index, index); error = git_index_conflict_add(index, NIL_P(rb_ancestor) ? NULL : &ancestor, NIL_P(rb_theirs) ? NULL : &ours, NIL_P(rb_ours) ? NULL : &theirs); rugged_exception_check(error); return Qnil;}
开发者ID:mkanoor,项目名称:rugged,代码行数:43,
示例3: rugged_signature_newVALUE rugged_signature_new(const git_signature *sig, const char *encoding_name){ VALUE rb_sig, rb_time; rb_encoding *encoding = rb_utf8_encoding(); if (encoding_name != NULL) encoding = rb_enc_find(encoding_name); rb_sig = rb_hash_new(); /* Allocate the time with a the given timezone */ rb_time = rb_funcall( rb_time_new(sig->when.time, 0), rb_intern("getlocal"), 1, INT2FIX(sig->when.offset * 60) ); rb_hash_aset(rb_sig, CSTR2SYM("name"), rb_enc_str_new(sig->name, strlen(sig->name), encoding)); rb_hash_aset(rb_sig, CSTR2SYM("email"), rb_enc_str_new(sig->email, strlen(sig->email), encoding)); rb_hash_aset(rb_sig, CSTR2SYM("time"), rb_time); return rb_sig;}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:27,
示例4: rb_git_index_conflicts/* * call-seq: * index.conflicts -> conflicts * * Return all conflicts in +index+. * * Each conflict is represented as a Hash with +:ancestor+, +:ours+ or * +:theirs+ key-value pairs, each containing index entry data. * * If the value of the +:ancestor+, +:ours+ or +:theirs+ key is +nil+, * that indicates that file in conflict did not exists in the respective tree. */static VALUE rb_git_index_conflicts(VALUE self){ VALUE rb_conflicts = rb_ary_new(); git_index *index; git_index_conflict_iterator *iter; const git_index_entry *ancestor, *ours, *theirs; int error; Data_Get_Struct(self, git_index, index); error = git_index_conflict_iterator_new(&iter, index); rugged_exception_check(error); while ((error = git_index_conflict_next(&ancestor, &ours, &theirs, iter)) == GIT_OK) { VALUE rb_conflict = rb_hash_new(); rb_hash_aset(rb_conflict, CSTR2SYM("ancestor"), rb_git_indexentry_fromC(ancestor)); rb_hash_aset(rb_conflict, CSTR2SYM("ours"), rb_git_indexentry_fromC(ours)); rb_hash_aset(rb_conflict, CSTR2SYM("theirs"), rb_git_indexentry_fromC(theirs)); rb_ary_push(rb_conflicts, rb_conflict); } git_index_conflict_iterator_free(iter); if (error != GIT_ITEROVER) rugged_exception_check(error); return rb_conflicts;}
开发者ID:mkanoor,项目名称:rugged,代码行数:42,
示例5: rb_git_rebase_next/* * call-seq: * Rebase.next() -> operation or nil * * Perform the next step in the rebase. The returned operation is a * Hash with its details or nil if there are no more operations to * perform. The Hash contains some of the following entries: * * :type :: * The type of operation being done. Can be one of +:pick+, * +:reword+, +:edit+, +:squash+, +:fixup+ or +:exec+. * * :id :: * The id of the commit being cherry-picked. Exists for all but * +:exec+ operations. * * :exec :: * If the operatin is +:exec+ this is what the user asked to be * executed. */static VALUE rb_git_rebase_next(VALUE self){ int error; git_rebase *rebase; git_rebase_operation *operation; VALUE hash, val; Data_Get_Struct(self, git_rebase, rebase); error = git_rebase_next(&operation, rebase); if (error == GIT_ITEROVER) return Qnil; rugged_exception_check(error); /* Create the operation hash out of the relevant details */ hash = rb_hash_new(); val = rebase_operation_type(operation); rb_hash_aset(hash, CSTR2SYM("type"), val); if (operation->type != GIT_REBASE_OPERATION_EXEC) { val = rugged_create_oid(&operation->id); rb_hash_aset(hash, CSTR2SYM("id"), val); } if (operation->exec) { val = rb_str_new_utf8(operation->exec); rb_hash_aset(hash, CSTR2SYM("exec"), val); } return hash;}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:52,
示例6: rb_git_delta_status_fromCstatic VALUE rb_git_delta_status_fromC(git_delta_t status){ switch(status) { case GIT_DELTA_UNMODIFIED: return CSTR2SYM("unmodified"); case GIT_DELTA_ADDED: return CSTR2SYM("added"); case GIT_DELTA_DELETED: return CSTR2SYM("deleted"); case GIT_DELTA_MODIFIED: return CSTR2SYM("modified"); case GIT_DELTA_RENAMED: return CSTR2SYM("renamed"); case GIT_DELTA_COPIED: return CSTR2SYM("copied"); case GIT_DELTA_IGNORED: return CSTR2SYM("ignored"); case GIT_DELTA_UNTRACKED: return CSTR2SYM("untracked"); case GIT_DELTA_TYPECHANGE: return CSTR2SYM("typechange"); default: return CSTR2SYM("unknown"); }}
开发者ID:RSMP-others,项目名称:sonic-pi,代码行数:25,
示例7: rb_redcarpet_htmltoc_initstatic VALUE rb_redcarpet_htmltoc_init(int argc, VALUE *argv, VALUE self){ struct rb_redcarpet_rndr *rndr; unsigned int render_flags = HTML_TOC; VALUE hash, nesting_level = Qnil; Data_Get_Struct(self, struct rb_redcarpet_rndr, rndr); if (rb_scan_args(argc, argv, "01", &hash) == 1) { Check_Type(hash, T_HASH); /* escape_html */ if (rb_hash_aref(hash, CSTR2SYM("escape_html")) == Qtrue) render_flags |= HTML_ESCAPE; /* Nesting level */ nesting_level = rb_hash_aref(hash, CSTR2SYM("nesting_level")); } sdhtml_toc_renderer(&rndr->callbacks, (struct html_renderopt *)&rndr->options.html, render_flags); rb_redcarpet__overload(self, rb_cRenderHTML_TOC); if (!(NIL_P(nesting_level))) rndr->options.html.toc_data.nesting_level = NUM2INT(nesting_level); else rndr->options.html.toc_data.nesting_level = 6; return Qnil;}
开发者ID:jinguoxing,项目名称:redcarpet,代码行数:29,
示例8: reflog_entry_newstatic VALUE reflog_entry_new(const git_reflog_entry *entry){ VALUE rb_entry = rb_hash_new(); const char *message; rb_hash_aset(rb_entry, CSTR2SYM("id_old"), rugged_create_oid(git_reflog_entry_id_old(entry)) ); rb_hash_aset(rb_entry, CSTR2SYM("id_new"), rugged_create_oid(git_reflog_entry_id_new(entry)) ); rb_hash_aset(rb_entry, CSTR2SYM("committer"), rugged_signature_new(git_reflog_entry_committer(entry), NULL) ); if ((message = git_reflog_entry_message(entry)) != NULL) { rb_hash_aset(rb_entry, CSTR2SYM("message"), rb_str_new_utf8(message)); } return rb_entry;}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:26,
示例9: rb_git_diff_patch_bytesize/* * call-seq: * patch.bytesize(options = {}) -> int * * The following options can be passed in the +options+ Hash: * * :exclude_context :: * Boolean value specifying that context lines should be excluded when * counting the number of bytes in the patch. * * :exclude_hunk_headers :: * Boolean value specifying that hunk headers should be excluded when * counting the number of bytes in the patch. * * :exclude_file_headers :: * Boolean value specifying that file headers should be excluded when * counting the number of bytes in the patch. * * Returns the number of bytes in the patch, depending on which options are * specified. */static VALUE rb_git_diff_patch_bytesize(int argc, VALUE *argv, VALUE self){ git_patch *patch; size_t bytesize; VALUE rb_options; int include_context, include_hunk_headers, include_file_headers; Data_Get_Struct(self, git_patch, patch); include_context = include_hunk_headers = include_file_headers = 1; rb_scan_args(argc, argv, "0:", &rb_options); if (!NIL_P(rb_options)) { if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_context")))) { include_context = 0; } if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_hunk_headers")))) { include_hunk_headers = 0; } if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_file_headers")))) { include_file_headers = 0; } } bytesize = git_patch_size(patch, include_context, include_hunk_headers, include_file_headers); return INT2FIX(bytesize);}
开发者ID:mkanoor,项目名称:rugged,代码行数:50,
示例10: rb_git_commit_to_mbox/* * call-seq: * commit.to_mbox(options = {}) -> str * * Returns +commit+'s contents formatted to resemble UNIX mailbox format. * * Does not (yet) support merge commits. * * The following options can be passed in the +options+ Hash: * * :patch_no :: * Number for this patch in the series. Defaults to +1+. * * :total_patches :: * Total number of patches in the series. Defaults to +1+. * * :exclude_subject_patch_marker :: * If set to true, no "[PATCH]" marker will be * added to the beginning of the subject line. * * Additionally, you can also pass the same options as for Rugged::Tree#diff. */static VALUE rb_git_commit_to_mbox(int argc, VALUE *argv, VALUE self){ git_buf email_patch = { NULL }; git_repository *repo; git_commit *commit; git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_format_email_flags_t flags = GIT_DIFF_FORMAT_EMAIL_NONE; VALUE rb_repo = rugged_owner(self), rb_email_patch = Qnil, rb_val, rb_options; int error; size_t patch_no = 1, total_patches = 1; rb_scan_args(argc, argv, ":", &rb_options); rugged_check_repo(rb_repo); Data_Get_Struct(rb_repo, git_repository, repo); Data_Get_Struct(self, git_commit, commit); if (!NIL_P(rb_options)) { Check_Type(rb_options, T_HASH); rb_val = rb_hash_aref(rb_options, CSTR2SYM("patch_no")); if (!NIL_P(rb_val)) patch_no = NUM2INT(rb_val); rb_val = rb_hash_aref(rb_options, CSTR2SYM("total_patches")); if (!NIL_P(rb_val)) total_patches = NUM2INT(rb_val); if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_subject_patch_marker")))) flags |= GIT_DIFF_FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER; rugged_parse_diff_options(&opts, rb_options); } error = git_diff_commit_as_email( &email_patch, repo, commit, patch_no, total_patches, flags, &opts); if (error) goto cleanup; rb_email_patch = rb_enc_str_new(email_patch.ptr, email_patch.size, rb_utf8_encoding()); cleanup: xfree(opts.pathspec.strings); git_buf_free(&email_patch); rugged_exception_check(error); return rb_email_patch;}
开发者ID:jacobvosmaer,项目名称:rugged,代码行数:80,
示例11: rb_git_tag_collection_create/* * call-seq: * tags.create(name, target[, force = false][, annotation = nil]) -> oid * * Create a new tag with the specified +name+ on +target+ in +repo+. * * If +annotation+ is not +nil+, it will cause the creation of an annotated tag object. * +annotation+ has to contain the following key value pairs: * * :tagger :: * An optional Hash containing a git signature. Defaults to the signature * from the configuration if only `:message` is given. Will cause the * creation of an annotated tag object if present. * * :message :: * An optional string containing the message for the new tag. * * Returns the OID of the newly created tag. */static VALUE rb_git_tag_collection_create(int argc, VALUE *argv, VALUE self){ git_oid tag_oid; git_repository *repo = NULL; git_object *target = NULL; int error, force = 0; VALUE rb_repo = rugged_owner(self), rb_name, rb_target, rb_force, rb_annotation; rb_scan_args(argc, argv, "21:", &rb_name, &rb_target, &rb_force, &rb_annotation); rugged_check_repo(rb_repo); Data_Get_Struct(rb_repo, git_repository, repo); Check_Type(rb_name, T_STRING); if (!NIL_P(rb_force)) force = rugged_parse_bool(rb_force); target = rugged_object_get(repo, rb_target, GIT_OBJ_ANY); if (NIL_P(rb_annotation)) { error = git_tag_create_lightweight( &tag_oid, repo, StringValueCStr(rb_name), target, force ); } else { git_signature *tagger = rugged_signature_get( rb_hash_aref(rb_annotation, CSTR2SYM("tagger")), repo ); VALUE rb_message = rb_hash_aref(rb_annotation, CSTR2SYM("message")); Check_Type(rb_message, T_STRING); error = git_tag_create( &tag_oid, repo, StringValueCStr(rb_name), target, tagger, StringValueCStr(rb_message), force ); git_signature_free(tagger); } git_object_free(target); rugged_exception_check(error); return rb_git_tag_collection_aref(self, rb_name);}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:74,
示例12: rb_git_note_remove/* * call-seq: * obj.remove_note(data = {}) -> boolean * * Removes a +note+ from +object+, with the given +data+ * arguments, passed as a +Hash+: * * - +:committer+ (optional): a hash with the signature for the committer, * defaults to the signature from the configuration * - +:author+ (optional): a hash with the signature for the author, * defaults to the signature from the configuration * - +:ref+: (optional): canonical name of the reference to use, defaults to "refs/notes/commits" * * When the note is successfully removed +true+ will be * returned as a +Boolean+. * * author = {:email=>"[email C++ CSTRING函数代码示例 C++ CSTR2RVAL函数代码示例
|